:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel-bg: #ffffffcc;
  --border: rgba(0, 0, 0, 0.08);
  --text-main: #101935;
  --text-muted: #5a6475;
  --blue: #2d77ff;
  --blue-dark: #1d53c2;
  --red: #e6404d;
  --red-dark: #b02f39;
  --hello: #f0f0ff;
  font-family: "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: linear-gradient(180deg, #f8fbff 0%, #f0f4ff 50%, #fdf2f5 100%);
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.6;
}

.app-shell {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) clamp(16px, 4vw, 32px) calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  gap: 16px;
}

.status-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-muted);
  box-shadow: 0 8px 18px rgba(24, 36, 82, 0.08);
  text-align: center;
}

.status-pill.is-hidden {
  display: none;
}

.status-pill.ready {
  background: #ecfdf5;
  border-color: #34d399;
  color: #065f46;
}

.status-pill.error {
  background: #fff1f2;
  border-color: #fb7185;
  color: #9f1239;
}

.panel {
  background: var(--panel-bg);
  border-radius: 18px;
  padding: clamp(14px, 4vw, 20px);
  border: 1px solid var(--border);
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.panel.partner {
  background: rgba(255, 255, 255, 0.95);
  transform: rotate(180deg);
  transform-origin: center;
}

.panel.user {
  background: rgba(255, 255, 255, 0.9);
}

.panel-heading h2 {
  margin: 0 0 4px;
}

.button-wrap {
  display: flex;
  justify-content: center;
  margin: clamp(8px, 2vw, 14px) 0 2px;
}

.speak-button {
  width: clamp(110px, 30vw, 180px);
  height: clamp(110px, 30vw, 180px);
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.speak-button.partner {
  background: var(--red);
}

.speak-button.user {
  background: var(--blue);
}

.speak-button:active,
.speak-button.is-listening {
  transform: scale(0.95);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.speak-button::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.speak-button.is-listening::after {
  border-color: rgba(255, 255, 255, 0.85);
  animation: pulse 1.2s infinite ease-in-out;
}

@media (min-width: 720px) {
  .selection-grid {
    flex-direction: row;
    gap: 16px;
  }

  .language-row {
    flex: 1;
  }
}

.language-toggle.is-hidden {
  display: none;
}

.language-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #fff;
  color: var(--text-main);
  min-height: 44px;
}

.language-select option {
  color: var(--text-main);
}

.language-select.is-hidden {
  display: none;
}

.transcript-card {
  margin-top: 8px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.transcript-card p {
  padding: 10px 12px;
  margin: 0;
}

.transcript-translation {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
}

.audio-player {
  width: 100%;
  margin-top: 10px;
  display: none;
  border-radius: 12px;
  background: #fff;
}

.audio-player.is-visible {
  display: block;
}

.status-line {
  text-align: center;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  min-height: 18px;
}

.status-line:not(.has-text) {
  visibility: hidden;
}

.status-line.is-error {
  color: #b42318;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.6;
  }
}

@media (max-width: 600px) {
  .panel {
    padding: 16px;
  }

  .selection-grid {
    grid-template-columns: 1fr;
  }

  footer {
    font-size: 12px;
  }
}
.app-shell.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}
