:root {
  color-scheme: light;
  --bg: #f7faf7;
  --panel: #ffffff;
  --panel-soft: #f0f6f3;
  --text: #23302b;
  --muted: #61716b;
  --line: #d8e4dd;
  --primary: #217a73;
  --primary-dark: #175e58;
  --coral: #d86f51;
  --coral-dark: #a54c3d;
  --amber: #e9ac30;
  --success: #2f8a5f;
  --danger: #b85a53;
  --skin: #f0b276;
  --skin-soft: #f4bf83;
  --shadow: 0 14px 30px rgba(34, 57, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    "Meiryo",
    sans-serif;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.top-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow,
.mode-summary,
.setting-label {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.session-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 8px;
  min-width: min(100%, 430px);
}

.session-board div {
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(34, 57, 51, 0.08);
}

.session-board span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.session-board strong {
  display: block;
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: 1.34rem;
  line-height: 1.1;
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(190px, 0.62fr) minmax(190px, 0.62fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment,
.action-button,
.frame-button,
  .curriculum-item,
  .stepper-button,
  .timer-option,
  .pool-shortcut,
  .pool-item,
  .auto-length-option,
  .text-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.segment {
  flex: 1 1 130px;
  padding: 10px 12px;
  font-weight: 800;
}

.segment:focus-visible,
.action-button:focus-visible,
.frame-button:focus-visible,
  .curriculum-item:focus-visible,
  .stepper-button:focus-visible,
  .timer-option:focus-visible,
  .pool-shortcut:focus-visible,
  .pool-item:focus-visible,
  .auto-length-option:focus-visible,
  .text-button:focus-visible {
  outline: 3px solid rgba(77, 127, 193, 0.35);
  outline-offset: 2px;
}

.segment:hover,
.action-button:hover,
.frame-button:hover,
  .curriculum-item:hover,
  .stepper-button:hover,
  .timer-option:hover,
  .pool-shortcut:hover,
  .pool-item:hover,
  .auto-length-option:hover,
  .text-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(34, 57, 51, 0.09);
}

.segment:disabled,
  .action-button:disabled,
  .stepper-button:disabled,
  .timer-option:disabled,
  .pool-shortcut:disabled,
  .pool-item:disabled,
  .auto-length-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.segment.is-active {
  border-color: rgba(33, 122, 115, 0.45);
  background: #e8f4f0;
  color: var(--primary-dark);
}

.setting-actions {
  display: flex;
  gap: 8px;
  justify-content: end;
}

.today-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(34, 57, 51, 0.08);
}

.today-description,
.pool-status,
.auto-session-help {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.selection-count {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.pool-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pool-shortcut,
.auto-length-option {
  min-width: 96px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 900;
}

.pool-shortcut.is-active,
.auto-length-option.is-active {
  border-color: rgba(37, 120, 54, 0.46);
  background: var(--panel-soft);
  color: var(--primary-dark);
}

.exercise-pool {
  display: grid;
  gap: 14px;
}

.pool-category {
  display: grid;
  gap: 8px;
}

.pool-category h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1rem;
}

.pool-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pool-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  text-align: left;
}

.pool-item > span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f6f1e8;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.pool-item strong {
  min-width: 0;
  line-height: 1.3;
}

.pool-item small {
  color: var(--coral-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.pool-item.is-selected {
  border-color: rgba(37, 120, 54, 0.52);
  background: var(--panel-soft);
  box-shadow: inset 0 0 0 2px rgba(37, 120, 54, 0.1);
}

.pool-item.is-selected::before {
  color: var(--primary-dark);
  content: "✓";
  font-weight: 900;
}

.pool-item.is-selected > span {
  display: none;
}

.action-button {
  min-width: 112px;
  padding: 10px 16px;
  font-weight: 900;
}

.action-button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.action-button.success {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}

.action-button.danger {
  border-color: rgba(184, 90, 83, 0.35);
  color: var(--danger);
}

.coach-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(260px, 0.9fr) minmax(280px, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
}

.tool-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(34, 57, 51, 0.08);
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.repetition-box {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 10px;
  align-items: center;
}

.repetition-box div {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.repetition-box strong {
  color: var(--primary-dark);
  font-size: 1.8rem;
  line-height: 1.1;
}

.repetition-box span {
  color: var(--muted);
  font-weight: 900;
}

.stepper-button {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 74px;
  color: var(--primary-dark);
  font-size: 1.7rem;
  font-weight: 900;
}

.timer-card {
  align-content: space-between;
}

.auto-card {
  align-content: space-between;
}

.auto-card h2 {
  color: var(--primary-dark);
  font-size: 1.35rem;
}

.auto-length-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.auto-length-option {
  min-width: 0;
}

.timer-card h2 {
  font-size: 2rem;
  color: var(--primary-dark);
}

.timer-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.timer-option {
  min-width: 0;
  padding: 8px;
  color: var(--muted);
  font-weight: 900;
}

.timer-option.is-active {
  border-color: rgba(33, 122, 115, 0.45);
  background: #e8f4f0;
  color: var(--primary-dark);
}

.text-button {
  min-height: 42px;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 900;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.62fr);
  gap: 14px;
  align-items: start;
}

.roulette-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 24px;
  align-items: center;
  margin-top: 18px;
  padding: clamp(20px, 4vw, 34px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 88% 18%, rgba(244, 221, 168, 0.42), transparent 30%),
    linear-gradient(145deg, #ffffff, #f4faf5);
  box-shadow: var(--shadow);
}

.roulette-copy {
  display: grid;
  gap: 14px;
  align-content: center;
}

.roulette-description {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.roulette-result-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 2px solid rgba(37, 120, 54, 0.24);
  border-radius: 10px;
  background: #ffffff;
}

.roulette-result-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.roulette-result-card strong {
  color: var(--primary-dark);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.25;
}

.roulette-spin-button {
  width: 100%;
  min-height: 62px;
  font-size: 1.08rem;
}

.roulette-stage {
  display: grid;
  place-items: center;
  min-width: 0;
}

.roulette-wheel {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 10px solid #ffffff;
  border-radius: 50%;
  box-shadow:
    0 18px 38px rgba(62, 47, 35, 0.16),
    inset 0 0 0 2px rgba(74, 55, 40, 0.12);
}

.roulette-wheel::after {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.roulette-labels {
  position: absolute;
  inset: 0;
}

.roulette-label {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 34%;
  transform: translate(-50%, -50%);
  color: #4a3728;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.roulette-label strong,
.roulette-label small {
  display: block;
}

.roulette-label.is-compact {
  width: 20%;
}

.roulette-label.is-compact strong {
  font-size: clamp(0.72rem, 1.7vw, 1.1rem);
  line-height: 1.15;
}

.roulette-label.is-compact small {
  display: none;
}

.roulette-label strong {
  font-size: clamp(1.25rem, 3.2vw, 2rem);
  line-height: 1.05;
}

.roulette-label small {
  margin-top: 4px;
  font-size: clamp(0.68rem, 1.6vw, 0.92rem);
  font-weight: 900;
  line-height: 1.25;
}

.roulette-spinner {
  position: absolute;
  z-index: 3;
  inset: 9%;
  border-radius: 50%;
  transition: transform 2.2s cubic-bezier(0.12, 0.7, 0.18, 1);
  pointer-events: none;
}

.roulette-spinner::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 42%;
  border-radius: 999px;
  background: #4a3728;
  box-shadow: 0 2px 5px rgba(62, 47, 35, 0.24);
  content: "";
  transform: translate(-50%, -100%);
}

.roulette-spinner span {
  position: absolute;
  top: 3%;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 16px solid transparent;
  border-bottom: 27px solid #4a3728;
  border-left: 16px solid transparent;
  filter: drop-shadow(0 2px 2px rgba(62, 47, 35, 0.18));
  transform: translateX(-50%) rotate(180deg);
}

.roulette-hub {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 1;
  border: 7px solid #ffffff;
  border-radius: 50%;
  background: #4a3728;
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(62, 47, 35, 0.22);
  font-size: 2rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.visual-panel,
.curriculum-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.visual-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.visual-header,
.section-head,
.visual-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-text {
  min-width: 190px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.visual-grid {
  display: grid;
  gap: 12px;
}

.visual-grid.is-child,
.visual-grid.is-teacher {
  grid-template-columns: minmax(0, 1fr);
}

.visual-grid.is-both {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.visual-grid.is-child .teacher-card,
.visual-grid.is-teacher .child-card {
  display: none;
}

.visual-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.visual-label {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.visual-label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.visual-label strong {
  color: var(--primary-dark);
  font-size: 1.18rem;
}

.character-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6efe2;
  isolation: isolate;
}

.character-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teacher-stage {
  background: #dff4f1;
}

.mouth-zone {
  --mouth-scale: 1;
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
}

.child-stage .mouth-zone {
  left: 40.8%;
  top: 62%;
  width: 18.4%;
  height: 9.5%;
}

.teacher-stage .mouth-zone {
  left: 24.5%;
  top: 33%;
  width: 51%;
  height: 25%;
}

.mouth-patch {
  position: absolute;
  inset: -28% -16%;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 24%, var(--skin-soft), var(--skin) 66%, #e9a469 100%);
  box-shadow: inset 0 -8px 22px rgba(142, 77, 54, 0.12);
}

.mouth-draw,
.tongue-draw {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--mouth-scale));
  transition:
    width 180ms ease,
    height 180ms ease,
    border-radius 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.mouth-draw {
  width: 70%;
  height: 8%;
  border-bottom: 4px solid #7f4335;
  border-radius: 0 0 999px 999px;
}

.teacher-stage .mouth-draw {
  border-bottom-width: 7px;
}

.character-stage[data-mouth="rest"] .mouth-draw {
  width: 66%;
  height: 12%;
  border-bottom-color: #8f4a3a;
}

.character-stage[data-mouth="small"] .mouth-draw,
.character-stage[data-mouth="open"] .mouth-draw,
.character-stage[data-mouth="wide"] .mouth-draw,
.character-stage[data-mouth="round"] .mouth-draw {
  border: 7px solid #d97562;
  background: #3a211f;
  box-shadow: inset 0 -14px 18px rgba(0, 0, 0, 0.18);
}

.character-stage[data-mouth="smile"] .mouth-draw {
  width: 82%;
  height: 20%;
  border-bottom-color: #8f4a3a;
  border-radius: 0 0 999px 999px;
  transform: translate(-50%, -42%) scale(var(--mouth-scale));
}

.character-stage[data-mouth="tight"] .mouth-draw {
  width: 54%;
  height: 9%;
  border-bottom: 7px solid #7f4335;
  border-radius: 999px;
  transform: translate(-50%, -48%) scale(var(--mouth-scale));
}

.character-stage[data-mouth="small"] .mouth-draw {
  width: 42%;
  height: 32%;
  border-radius: 50%;
}

.character-stage[data-mouth="open"] .mouth-draw {
  width: 54%;
  height: 52%;
  border-radius: 48% 48% 52% 52%;
}

.character-stage[data-mouth="wide"] .mouth-draw {
  width: 66%;
  height: 66%;
  border-radius: 50% 50% 56% 56%;
}

.character-stage[data-mouth="round"] .mouth-draw {
  width: 38%;
  height: 46%;
  border-radius: 999px;
  border-color: #c65f55;
}

.tongue-draw {
  opacity: 0;
  background: #ef8891;
  border: 3px solid rgba(166, 75, 82, 0.5);
  box-shadow: inset 0 -7px 10px rgba(150, 48, 63, 0.12);
}

.teacher-stage .tongue-draw {
  border-width: 5px;
}

.character-stage[data-tongue="tip"] .tongue-draw {
  top: 59%;
  width: 30%;
  height: 24%;
  border-radius: 0 0 999px 999px;
  opacity: 1;
}

.character-stage[data-tongue="out"] .tongue-draw {
  top: 70%;
  width: 36%;
  height: 48%;
  border-radius: 10px 10px 999px 999px;
  opacity: 1;
}

.character-stage[data-tongue="up"] .tongue-draw {
  top: 39%;
  width: 36%;
  height: 30%;
  border-radius: 999px 999px 10px 10px;
  opacity: 1;
}

.character-stage[data-tongue="click"] .tongue-draw {
  top: 35%;
  width: 42%;
  height: 22%;
  border-radius: 999px 999px 10px 10px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(180deg);
}

.character-stage[data-tongue="down"] .tongue-draw {
  top: 68%;
  width: 34%;
  height: 36%;
  border-radius: 10px 10px 999px 999px;
  opacity: 1;
}

.character-stage[data-tongue="left"] .tongue-draw {
  left: 34%;
  top: 58%;
  width: 42%;
  height: 24%;
  border-radius: 999px 10px 10px 999px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(-16deg);
}

.character-stage[data-tongue="right"] .tongue-draw {
  left: 66%;
  top: 58%;
  width: 42%;
  height: 24%;
  border-radius: 10px 999px 999px 10px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(16deg);
}

.character-stage[data-tongue="corner-left"] .tongue-draw {
  left: 23%;
  top: 53%;
  width: 38%;
  height: 22%;
  border-radius: 999px 10px 10px 999px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(-26deg);
}

.character-stage[data-tongue="corner-right"] .tongue-draw {
  left: 77%;
  top: 53%;
  width: 38%;
  height: 22%;
  border-radius: 10px 999px 999px 10px;
  opacity: 1;
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(26deg);
}

.character-stage[data-tongue="circle"] .tongue-draw,
.character-stage[data-tongue="circle-reverse"] .tongue-draw {
  top: 57%;
  width: 70%;
  height: 48%;
  border: 5px solid rgba(166, 75, 82, 0.62);
  border-top-color: transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  opacity: 1;
}

.character-stage[data-tongue="circle"] .tongue-draw {
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(-22deg);
}

.character-stage[data-tongue="circle-reverse"] .tongue-draw {
  transform: translate(-50%, -50%) scale(var(--mouth-scale)) rotate(22deg);
}

.character-stage[data-tongue="inside-up"] .tongue-draw,
.character-stage[data-tongue="inside-down"] .tongue-draw {
  width: 32%;
  height: 24%;
  border: 3px dashed rgba(166, 75, 82, 0.75);
  background: rgba(239, 136, 145, 0.5);
  box-shadow: none;
  opacity: 1;
}

.character-stage[data-tongue="inside-up"] .tongue-draw {
  top: 30%;
  border-radius: 999px 999px 12px 12px;
}

.character-stage[data-tongue="inside-down"] .tongue-draw {
  top: 70%;
  border-radius: 12px 12px 999px 999px;
}

.cheek-puff {
  --cheeks: 0;
  position: absolute;
  z-index: 2;
  width: 18%;
  height: 15%;
  border-radius: 50%;
  background: rgba(239, 139, 108, 0.45);
  opacity: calc(var(--cheeks) * 0.85);
  transform: scale(calc(0.75 + var(--cheeks) * 0.42));
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.character-stage[data-cheeks="left-puff"] .cheek-right,
.character-stage[data-cheeks="right-puff"] .cheek-left {
  opacity: 0;
}

.character-stage[data-cheeks="hollow"] .cheek-puff {
  border: 2px solid rgba(127, 67, 53, 0.12);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(127, 67, 53, 0.18), rgba(127, 67, 53, 0.06) 50%, transparent 72%);
  box-shadow: inset 0 2px 8px rgba(127, 67, 53, 0.22);
  opacity: calc(0.2 + var(--cheeks) * 0.7);
  transform: scale(calc(0.85 - var(--cheeks) * 0.22));
}

.character-stage[data-cheeks^="tongue-right"] .cheek-left,
.character-stage[data-cheeks^="tongue-left"] .cheek-right {
  opacity: 0;
}

.character-stage[data-cheeks$="-press"] .cheek-puff {
  border: 3px solid rgba(166, 75, 82, 0.48);
  background: radial-gradient(circle, rgba(239, 136, 145, 0.72) 0 26%, rgba(239, 136, 145, 0.18) 30% 62%, transparent 66%);
  box-shadow: none;
}

.character-stage[data-cheeks$="-circle"] .cheek-puff {
  border: 3px dashed rgba(166, 75, 82, 0.62);
  background: transparent;
  box-shadow: none;
  animation: tongue-cheek-circle 1.2s linear infinite;
}

@keyframes tongue-cheek-circle {
  to {
    rotate: 360deg;
  }
}

.child-stage .cheek-left {
  left: 21%;
  top: 58%;
}

.child-stage .cheek-right {
  right: 21%;
  top: 58%;
}

.teacher-stage .cheek-puff {
  width: 20%;
  height: 19%;
}

.teacher-stage .cheek-left {
  left: 7%;
  top: 38%;
}

.teacher-stage .cheek-right {
  right: 7%;
  top: 38%;
}

.frame-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.frame-button {
  display: grid;
  min-width: 0;
  padding: 8px;
  color: var(--muted);
  font-weight: 800;
}

.frame-button span {
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.frame-button.is-active {
  border-color: rgba(216, 111, 81, 0.55);
  background: #fff1ea;
  color: var(--coral-dark);
}

.control-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.curriculum-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.curriculum-list {
  display: grid;
  gap: 8px;
}

.curriculum-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  text-align: left;
}

.curriculum-item.is-active {
  border-color: rgba(33, 122, 115, 0.48);
  background: #eaf5f2;
}

.curriculum-item.is-done {
  border-color: rgba(47, 138, 95, 0.35);
}

.curriculum-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 900;
}

.curriculum-item.is-done .curriculum-mark {
  background: var(--success);
  color: #ffffff;
}

.curriculum-title {
  display: block;
  color: var(--text);
  font-weight: 900;
}

.curriculum-note {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.curriculum-count {
  color: var(--primary-dark);
  font-weight: 900;
}

.support-note {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.support-note p {
  margin-bottom: 6px;
}

.support-note p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(18, 33, 29, 0.3);
}

.celebration.is-visible {
  display: grid;
}

.celebration-card {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 55px rgba(18, 33, 29, 0.2);
  text-align: center;
}

.celebration-mark {
  display: inline-grid;
  place-items: center;
  min-width: 88px;
  min-height: 46px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: #fff1cf;
  color: #9a6814;
  font-weight: 900;
}

.celebration-message {
  margin: 8px 0 16px;
  color: var(--muted);
  font-weight: 800;
}

.reference-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reference-panel p,
.reference-links {
  margin: 0;
}

.reference-links {
  display: grid;
  gap: 6px;
  padding-left: 1.4rem;
}

.reference-links a {
  color: var(--primary-dark);
  font-weight: 800;
  text-underline-offset: 3px;
}

.safety-note {
  padding: 12px;
  border-left: 5px solid var(--amber);
  border-radius: 6px;
  background: #fff8e8;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 920px) {
  .top-bar,
  .practice-layout,
  .settings-panel,
  .coach-panel,
  .roulette-section {
    grid-template-columns: 1fr;
  }

  .top-bar {
    display: grid;
  }

  .setting-actions {
    justify-content: stretch;
  }

  .setting-actions .action-button {
    flex: 1;
  }

  .visual-grid.is-both {
    grid-template-columns: 1fr;
  }

  .status-text {
    min-width: 0;
    text-align: left;
  }

  .pool-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 14px;
  }

  .control-row,
  .frame-strip {
    grid-template-columns: 1fr;
  }

  .session-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .timer-options {
    grid-template-columns: 1fr;
  }

  .pool-category-grid {
    grid-template-columns: 1fr;
  }

  .pool-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pool-shortcut:first-child {
    grid-column: 1 / -1;
  }

  .tool-head {
    align-items: stretch;
    flex-direction: column;
  }

  .visual-header,
  .section-head,
  .visual-label {
    align-items: stretch;
    flex-direction: column;
  }

  .action-button {
    width: 100%;
  }
}

/* LiNest v3: 口・舌・肌の教材色を保ち、操作面と外枠を統一する。 */
body.linest-themed {
  --bg: var(--linest-bg);
  --panel: var(--linest-surface);
  --panel-soft: var(--linest-green-soft);
  --text: var(--linest-text);
  --muted: var(--linest-muted);
  --line: var(--linest-border);
  --primary: var(--linest-green);
  --primary-dark: var(--linest-green-dark);
  --coral: var(--linest-warm);
  --coral-dark: var(--linest-terracotta-dark);
  --shadow: var(--linest-shadow);
}

body.linest-themed .top-bar {
  padding: 16px 18px;
  border: 1px solid var(--linest-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--linest-shadow);
}

body.linest-themed :where(.session-board div, .settings-panel, .today-panel, .tool-card, .visual-panel, .curriculum-panel, .visual-card, .support-note, .reference-panel, .celebration-card) {
  border-color: var(--linest-border);
  background-color: rgba(255, 255, 255, 0.96);
  box-shadow: var(--linest-shadow);
}

body.linest-themed :where(.segment, .action-button, .frame-button, .curriculum-item, .stepper-button, .timer-option, .pool-shortcut, .pool-item, .auto-length-option, .text-button) {
  border-color: var(--linest-border);
  background-color: #ffffff;
  color: var(--linest-text);
}

body.linest-themed :where(.segment.is-active, .timer-option.is-active, .pool-shortcut.is-active, .pool-item.is-selected, .auto-length-option.is-active, .frame-button.is-active, .curriculum-item.is-active) {
  border-color: var(--linest-green);
  background: var(--linest-green-soft);
  color: var(--linest-green-dark);
}

body.linest-themed button.roulette-spin-button {
  min-height: 62px;
  border-color: var(--linest-green);
  background: var(--linest-green);
  color: #ffffff;
}

body.linest-themed button.pool-item {
  min-height: 54px;
}

body.linest-themed button.pool-shortcut,
body.linest-themed #characterControls .segment {
  min-height: 48px;
}

body.linest-themed button#autoSessionButton {
  min-height: 58px;
}

@media (max-width: 560px) {
  body.linest-themed :where(.segment, .action-button, .timer-option, .pool-shortcut, .pool-item, .auto-length-option, .frame-button, .curriculum-item) {
    min-width: 0;
    padding-inline: 8px;
    white-space: normal;
    word-break: keep-all;
  }

  body.linest-themed .exercise-menu .segment {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .roulette-section {
    gap: 18px;
    padding: 18px 14px;
  }

  .roulette-wheel {
    width: min(100%, 340px);
    border-width: 7px;
  }

  .roulette-hub {
    width: 58px;
    border-width: 5px;
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roulette-spinner {
    transition-duration: 1ms;
  }

  .character-stage[data-cheeks$="-circle"] .cheek-puff {
    animation: none;
  }
}
