/* The look follows mimic.etak64n.dev: a light gray-green page, white panels with a thin border
   and a soft shadow, 8px corners, a teal accent and heavy type. */

:root {
  color-scheme: light;
  --background: #f6f7f5;
  --panel: #ffffff;
  --panel-soft: #eef2ef;
  --surface: #fbfcfb;
  --text: #191d1b;
  --muted: #68706b;
  --line: #d9dfda;
  --accent: #087f8c;
  --accent-strong: #056672;
  --accent-bg: #eef9fa;
  --accent-line: #9bd5da;
  --green: #1f8a4c;
  --green-bg: #e7f5ec;
  --green-line: #9cd7b2;
  /* 賛成 uses the teal accent and 反対 uses amber: a pair that stays apart with common color vision deficiencies. */
  --amber: #b86916;
  --amber-bg: #fff1d9;
  --amber-line: #f0c579;
  --shadow: 0 16px 40px rgba(25, 29, 27, 0.08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* Top bar */

.topbar {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: block;
  flex: none;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #050609;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.tablist {
  display: grid;
  flex: 0 1 360px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.tab {
  min-height: 40px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(25, 29, 27, 0.08);
}

/* Panels */

.panel {
  display: grid;
  gap: 16px;
  align-items: start;
}

.panel-phrases,
.panel-settings {
  max-width: 760px;
  margin: 0 auto;
}

.sheet,
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sheet {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.card {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

.section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

.tools-panel > .section:first-child {
  padding-top: 0;
  border-top: 0;
}

.subhead {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.note,
.panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

/* Topic */

.topic-body {
  display: grid;
}

.topic.is-new .topic-body {
  animation: rise 0.24s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.mode-badge.large {
  padding: 6px 10px;
  font-size: 12px;
}

.mode-badge.type-yesno {
  border-color: var(--accent-line);
  background: var(--accent-bg);
  color: var(--accent);
}

.mode-badge.type-open {
  border-color: var(--green-line);
  background: var(--green-bg);
  color: var(--green);
}

.context-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dots {
  display: inline-flex;
  gap: 3px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.dot.is-on {
  background: var(--accent);
}

.round {
  font-variant-numeric: tabular-nums;
}

.prompt-block {
  display: flex;
  align-items: center;
  min-height: 200px;
  margin-top: 16px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.prompt-content {
  display: grid;
  gap: 12px;
  width: 100%;
}

.question-ja {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 850;
  line-height: 1.35;
  font-feature-settings: "palt" 1;
  overflow-wrap: anywhere;
  word-break: auto-phrase;
  text-wrap: pretty;
}

.question-en {
  margin: 0;
  color: var(--accent);
  font-size: clamp(16px, 1.5vw, 19px);
  font-weight: 750;
  line-height: 1.4;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.topic-message {
  display: grid;
  gap: 12px;
  align-content: center;
  justify-items: start;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topic-message p {
  margin: 0;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.button:disabled,
.primary-action:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary,
.button-primary:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.button-block {
  width: 100%;
}

.button-next {
  min-height: 50px;
  font-size: 16px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.primary-action,
.icon-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.primary-action {
  width: 48px;
  height: 48px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-action:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.icon-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

/* Stance and perspective */

.stance-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 8px;
}

.stance-button[data-stance="yes"] {
  color: var(--accent);
}

.stance-button[data-stance="no"] {
  color: var(--amber);
}

.stance-button[data-stance="no"]:hover:not(:disabled) {
  border-color: var(--amber);
  color: var(--amber);
}

.stance-button[data-stance="yes"][aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.stance-button[data-stance="no"][aria-pressed="true"] {
  border-color: var(--amber);
  background: var(--amber-bg);
}

.stance-button[aria-pressed="true"]::before {
  content: "✓";
}

.perspective {
  display: grid;
  gap: 10px;
}

.perspective-text {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.perspective-text strong {
  color: var(--green);
  font-size: 17px;
  font-weight: 900;
}

.perspective-en {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.badge-yes {
  border-color: var(--accent-line);
  background: var(--accent-bg);
  color: var(--accent);
}

.badge-no {
  border-color: var(--amber-line);
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-neutral {
  color: var(--text);
}

/* Timer */

.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-action .icon-pause,
.primary-action[data-running="true"] .icon-play {
  display: none;
}

.primary-action[data-running="true"] .icon-pause {
  display: block;
}

.timer {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background 160ms ease, border-color 160ms ease;
}

.timer.is-running {
  border-color: var(--accent-line);
  background: var(--accent-bg);
}

.timer-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.timer-phase {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.timer-time {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer[data-phase="speak"] .timer-time {
  color: var(--accent);
}

.timer[data-phase="done"] .timer-time {
  color: var(--muted);
}

.timer-bar {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  -webkit-appearance: none;
  appearance: none;
}

.timer-bar::-webkit-progress-bar {
  background: var(--line);
}

.timer-bar::-webkit-progress-value {
  background: var(--accent);
}

.timer-bar::-moz-progress-bar {
  background: var(--accent);
}

/* Hints and pushback */

.hint {
  display: grid;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hint-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 900;
}

.hint-list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.hint-list li + li {
  margin-top: 4px;
}

.counter-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.counter-card.is-yes {
  border-color: var(--accent-line);
  background: var(--accent-bg);
}

.counter-card.is-no {
  border-color: var(--amber-line);
  background: var(--amber-bg);
}

.counter-card.is-open {
  border-color: var(--green-line);
  background: var(--green-bg);
}

.counter-card .badge {
  background: var(--panel);
}

.counter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.counter-text {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.5;
}

.counter-ask {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* Steps and phrases */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 6px 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.step:hover {
  border-color: var(--accent);
}

.step-number {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.step[aria-current="step"] {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.step[aria-current="step"] .step-number {
  background: var(--accent);
  color: #ffffff;
}

.step-phrases,
.phrase-sections {
  display: grid;
  gap: 14px;
}

.phrase-group {
  display: grid;
  gap: 8px;
}

.phrase-scene {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.phrase-sections .phrase-scene {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.phrase-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.phrase {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.phrase:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.phrase-en {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}

.star {
  margin-right: 6px;
  color: var(--accent);
}

.phrase-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

/* Group */

/* details does not lay out reliably as a grid container in every browser. */
.group {
  display: block;
}

.group-body {
  margin-top: 10px;
}

.group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
}

.group > summary::-webkit-details-marker {
  display: none;
}

.group > summary::after {
  content: "＋";
  color: var(--muted);
  font-size: 16px;
}

.group[open] > summary::after {
  content: "－";
}

.group-body {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 7.5em;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 700;
  line-height: 1.6;
  resize: vertical;
}

.group-result {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.group-result:empty {
  display: none;
}

.group-result li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 800;
}

.group-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Settings */

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.checks-single {
  grid-template-columns: minmax(0, 1fr);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.check:hover {
  border-color: var(--accent);
}

.check:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-bg);
}

.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.check-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.check-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  font-weight: 800;
}

.field input {
  width: 6.5em;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Teacher view */

.teacher-view {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  border: 0;
  background: var(--panel);
  color: var(--text);
}

.teacher-view[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.teacher-view::backdrop {
  background: var(--panel);
}

.teacher-question {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(32px, 1.4rem + 4.5vw, 72px);
  font-weight: 850;
  line-height: 1.18;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.offscreen {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.noscript {
  margin: 24px 16px;
}

/* Wide screens: the practice panel with the tools panel beside it, as mimic shows its score panel. */

@media (min-width: 1000px) {
  .panel-topic {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
  }

  .tools-panel {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 108px);
    overflow: auto;
  }

  .phrase-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .panel-phrases {
    max-width: none;
  }
}

/* Phones */

@media (max-width: 760px) {
  .app {
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .topbar {
    margin-bottom: 10px;
    padding: 6px;
  }

  .panel {
    gap: 10px;
  }

  .sheet,
  .card {
    box-shadow: none;
  }

  .sheet {
    padding: 16px;
  }

  .prompt-block {
    min-height: 160px;
    padding: 22px 0;
  }

  .question-ja {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .tablist {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
