:root {
  --blue: #075fd6;
  --blue-dark: #003a9b;
  --blue-deep: #002b78;
  --text: #17263a;
  --muted: #65758d;
  --green: #23a900;
  --green-dark: #087f00;
  --red: #d93a34;
  --red-dark: #9f1714;
  --orange: #a96600;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: linear-gradient(180deg, #fbfdff 0%, #eef5fd 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page {
  width: min(100%, 500px);
  margin: 0 auto;
  padding: 12px 12px 88px;
  border: 1px solid #cbd9ea;
  border-radius: 20px;
  background: rgba(255,255,255,.72);
}

.app {
  overflow: hidden;
  border: 2px solid #00398f;
  border-radius: 16px;
  background: linear-gradient(90deg, #003e9e 0 11px, #eef3fa 11px calc(100% - 11px), #003e9e calc(100% - 11px));
  box-shadow: 0 9px 23px rgba(26,71,130,.18), inset 0 0 0 1px rgba(255,255,255,.55);
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68px;
  padding: 10px 70px 12px 20px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 18%),
    linear-gradient(180deg, #0c70f1 0%, #0055c7 55%, #00358f 100%);
  border-bottom: 1px solid #002d7d;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), inset 0 -7px 13px rgba(0,21,76,.24);
}
.app-header h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: .035em;
  text-shadow: 0 3px 3px rgba(0,35,104,.55), 0 0 2px rgba(255,255,255,.8);
}
.header-ear {
  position: absolute;
  right: 26px;
  top: 10px;
  width: 54px;
  height: 54px;
  fill: none;
  stroke: #fff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px rgba(0,28,92,.55));
}

.app-main {
  display: grid;
  gap: 7px;
  margin: 0 11px 10px;
  padding: 42px 16px 12px;
  border-radius: 36px 36px 24px 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.85), transparent 17%),
    linear-gradient(180deg, #f4f7fc 0%, #e8eef7 100%);
  box-shadow: inset 0 2px 0 #fff, inset 0 0 0 1px #c7d3e2;
}

.card {
  border: 1px solid #b8c6d8;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #eef3fa 100%);
  box-shadow:
    0 3px 5px rgba(39,66,105,.20),
    inset 0 2px 1px rgba(255,255,255,.98),
    inset 0 -4px 9px rgba(124,147,178,.11);
}

.power-card {
  margin-top: -1px;
  padding: 12px 13px;
  text-align: center;
  border-radius: 19px;
  background: linear-gradient(180deg, #f9fbff, #e7edf6);
  box-shadow: 0 4px 6px rgba(50,75,111,.25), inset 0 2px 2px #fff, inset 0 -3px 6px rgba(90,115,150,.13);
}
.power-toggle {
  --power-icon-size: 48px;
  display: grid;
  grid-template-columns: var(--power-icon-size) minmax(0, 1fr) var(--power-icon-size);
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 73px;
  margin: 0;
  padding: 6px 18px;
  border: 3px solid #a8dc39;
  outline: 2px solid #087b07;
  outline-offset: -5px;
  border-radius: 20px;
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 6px 9px rgba(24,67,28,.38),
    inset 0 3px 1px rgba(255,255,255,.55),
    inset 0 -7px 13px rgba(0,66,0,.30);
  transition: transform .08s ease, filter .15s ease, background .18s ease;
}
.power-toggle:active:not(:disabled) { transform: translateY(2px); }
.power-toggle:disabled { cursor: not-allowed; filter: grayscale(.25) brightness(.93); opacity: .78; }
.power-toggle.start-state { background: linear-gradient(180deg, #86e819 0%, #42bd04 46%, #139500 100%); }
.power-toggle.stop-state {
  border-color: #ff9d97;
  outline-color: #941713;
  background: linear-gradient(180deg, #ff736b 0%, #db3933 48%, #a51d18 100%);
}
.power-toggle::before {
  content: "";
  width: var(--power-icon-size);
  height: var(--power-icon-size);
}
.power-label {
  grid-column: 2;
  justify-self: center;
  min-width: 1.2em;
  font-size: clamp(2.8rem, 12vw, 4rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: .05em;
  text-align: center;
  text-shadow: 0 3px 2px rgba(0,73,0,.55);
}
.stop-state .power-label { text-shadow: 0 3px 2px rgba(104,9,6,.55); }
.power-speaker {
  grid-column: 3;
  justify-self: center;
  width: var(--power-icon-size);
  height: var(--power-icon-size);
  fill: #fff;
  stroke: #fff;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px rgba(0,65,0,.45));
}

.status-text {
  display: none;
  margin: 9px 4px 0;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.74);
  font-size: .88rem;
  font-weight: 750;
  line-height: 1.35;
}
.status-text.is-visible { display: block; }
.status-text.is-error { color: #ae2925; background: #fff2f1; }
.status-text.is-warn { color: var(--orange); background: #fff8e9; }
.status-text.is-on { color: #157b23; }

.mode-card { padding: 9px 10px; }
.mode-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 57px;
  padding: 7px 8px;
  border: 2px solid #aebed2;
  border-radius: 14px;
  color: #263241;
  background: linear-gradient(180deg, #ffffff 0%, #e6ebf2 100%);
  box-shadow: 0 3px 4px rgba(59,80,109,.22), inset 0 2px 1px #fff, inset 0 -4px 8px rgba(100,124,154,.13);
  cursor: pointer;
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.mode-button:active { transform: translateY(1px); }
.mode-button[aria-pressed="true"] {
  color: #07469e;
  border: 3px solid #0871ef;
  background: linear-gradient(180deg, #f4f9ff 0%, #cddfff 100%);
  box-shadow: 0 3px 5px rgba(0,76,180,.28), inset 0 2px 1px #fff, inset 0 -4px 8px rgba(42,103,194,.16);
}
.mode-icon-svg {
  width: 35px;
  height: 35px;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.conversation-icon path:first-child { fill: currentColor; stroke: currentColor; }
.conversation-icon path:last-child { fill: none; }
.mode-name { font-size: clamp(1.25rem, 5.4vw, 1.75rem); font-weight: 900; line-height: 1; }

.sliders-card { padding: 7px 8px 10px; }
.sliders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.slider-panel {
  min-width: 0;
  padding: 0 8px 2px;
  text-align: center;
}
.slider-panel + .slider-panel { border-left: 1px solid #cbd5e2; }
.slider-title {
  display: grid;
  place-items: center;
  min-height: 42px;
  margin: 0;
  color: #0a4aa6;
  font-size: clamp(1.01rem, 4.2vw, 1.28rem);
  font-weight: 950;
  line-height: 1.15;
}
.slider-layout {
  display: grid;
  grid-template-columns: minmax(34px, .8fr) 52px 20px;
  align-items: stretch;
  justify-content: center;
  min-height: 166px;
  margin: 0 auto;
}
.scale-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 1px 2px 0;
  color: #2a3647;
  font-size: clamp(.76rem, 3.1vw, .91rem);
  font-weight: 750;
  text-align: left;
}
.vertical-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 166px;
}
.vertical-wrap::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 164px;
  border: 1px solid #c9d5e4;
  border-radius: 999px;
  background: linear-gradient(90deg, #e2e9f2, #fff 45%, #dce5f0);
  box-shadow: inset 0 1px 3px rgba(47,75,110,.22), 0 1px 0 #fff;
}
.vertical-range {
  --fill: 25%;
  position: relative;
  z-index: 2;
  width: 154px;
  height: 44px;
  margin: 0;
  padding: 0;
  transform: rotate(-90deg);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
.vertical-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 17px;
  border: 1px solid #809ab8;
  border-radius: 999px;
  background: linear-gradient(to right, #0755c8 0%, #1486ff var(--fill), #dce6f1 var(--fill), #f7fbff 100%);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.85), inset 0 -3px 5px rgba(0,50,130,.20), 0 1px 2px rgba(30,59,95,.25);
}
.vertical-range::-webkit-slider-thumb {
  width: 43px;
  height: 43px;
  margin-top: -14px;
  border: 1px solid #b4c2d3;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 31%, #ffffff 0%, #ffffff 27%, #edf2f8 53%, #cad4e1 83%, #aab8ca 100%);
  box-shadow: 0 4px 6px rgba(52,76,108,.33), inset 0 2px 2px #fff, inset 0 -3px 5px rgba(85,106,134,.18);
  -webkit-appearance: none;
}
.vertical-range::-moz-range-track {
  width: 100%;
  height: 17px;
  border: 1px solid #809ab8;
  border-radius: 999px;
  background: #e7edf5;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.85), inset 0 -3px 5px rgba(0,50,130,.20);
}
.vertical-range::-moz-range-progress {
  height: 17px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0755c8, #1486ff);
}
.vertical-range::-moz-range-thumb {
  width: 41px;
  height: 41px;
  border: 1px solid #b4c2d3;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 31%, #fff 0%, #fff 27%, #edf2f8 53%, #cad4e1 83%, #aab8ca 100%);
  box-shadow: 0 4px 6px rgba(52,76,108,.33), inset 0 2px 2px #fff;
}
.tick-marks {
  align-self: center;
  width: 13px;
  height: 145px;
  margin-left: 2px;
  background: repeating-linear-gradient(to bottom, #8fa2b8 0 2px, transparent 2px 15px);
  opacity: .9;
}
.slider-value {
  display: inline-flex;
  min-width: 72px;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  padding: 3px 10px;
  border: 1px solid #b6c5d8;
  border-radius: 8px;
  color: #0b4497;
  background: linear-gradient(180deg, #fff, #eef2f8);
  box-shadow: inset 0 2px 1px #fff, 0 1px 2px rgba(44,70,105,.13);
  font-size: clamp(1.45rem, 6vw, 1.85rem);
  font-weight: 950;
  line-height: 1;
}

.device-note {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 5px;
  min-height: 58px;
  padding: 7px 9px;
  text-align: center;
  color: #0d4aa3;
  background: linear-gradient(180deg, #eaf4ff, #dcecff);
  border: 1px solid #b8d3f4;
  border-radius: 15px;
  box-shadow: inset 0 2px 1px #fff, inset 0 -4px 8px rgba(31,92,170,.08);
  font-size: clamp(.86rem, 3.5vw, 1.05rem);
  font-weight: 900;
  line-height: 1.25;
}
.note-speaker {
  width: 38px;
  height: 38px;
  fill: #0758c8;
  stroke: #0758c8;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-footer { padding: 12px 0 20px; text-align: center; color: #1565c0; font-size: .94rem; }
.app-footer p { margin: 0; }
.app-footer a { color: #1565c0; text-decoration: none; font-weight: 800; }
.footer-note { max-width: 500px; margin: 7px auto 0 !important; padding: 0 10px; color: #6a7890; font-size: .81rem; line-height: 1.6; }

.ad-panel { max-width: 500px; margin: 12px auto 0; padding: 0; border: 1px solid #d7e6f8; border-radius: 10px; background: #fff; overflow: hidden; }
.ad-panel[hidden] { display: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; height: 0 !important; overflow: hidden !important; }
.ad-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; background: #f4f8ff; border-bottom: 1px solid #d7e6f8; }
.ad-label { font-size: .72rem; color: #4f6f91; line-height: 1; }
.ad-close-area { display: flex; align-items: center; gap: 8px; }
.ad-close-message { font-size: .72rem; color: #4f6f91; }
.ad-close-btn { margin: 0 !important; padding: 3px 8px !important; min-height: 0; line-height: 1.2; border: none; border-radius: 999px; background: #1565c0; color: #fff; font-size: .72rem !important; font-weight: 700; cursor: pointer; }
.ad-close-btn:hover { background: #0d47a1; }
.ad-body { padding: 8px; background: #fff; }
.hidden { display: none !important; }

@media (max-width: 390px) {
  .page { padding: 6px 5px 72px; border-radius: 14px; }
  .app-main { margin-left: 8px; margin-right: 8px; padding: 34px 10px 10px; }
  .app-header { min-height: 62px; padding-right: 62px; }
  .app-header h1 { font-size: 2.05rem; }
  .header-ear { right: 16px; width: 47px; height: 47px; }
  .power-card { padding: 10px; }
  .power-toggle { --power-icon-size: 42px; min-height: 68px; }
  .power-label { font-size: 3rem; }
  .power-speaker { width: 42px; height: 42px; }
  .mode-button { min-height: 54px; gap: 7px; }
  .mode-icon-svg { width: 30px; height: 30px; }
  .mode-name { font-size: 1.25rem; }
  .slider-panel { padding-left: 3px; padding-right: 3px; }
  .slider-title { font-size: .96rem; }
  .slider-layout { grid-template-columns: 34px 48px 16px; }
  .scale-labels { font-size: .7rem; }
  .vertical-range { width: 154px; height: 42px; }
  .tick-marks { width: 11px; }
  .slider-value { min-width: 64px; font-size: 1.35rem; }
  .device-note { grid-template-columns: 34px 1fr 34px; padding-left: 5px; padding-right: 5px; font-size: .82rem; }
  .note-speaker { width: 31px; height: 31px; }
}


.connection-guide {
  margin: 0 0 9px;
  padding: 8px 10px;
  border: 1px solid #bfd7ff;
  border-radius: 10px;
  color: #174f91;
  background: #f3f8ff;
  font-size: .86rem;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}
