:root {
  --ink: #16121c;
  --muted: #5c5566;
  --paper: #fff3d6;
  --panel: #fffdf5;
  --red: #ff3b5c;
  --red-dark: #d92645;
  --yellow: #ffc93c;
  --yellow-soft: #ffe08a;
  --blue: #28a7e9;
  --blue-dark: #1272b8;
  --green: #23c483;
  --purple: #7d5fff;
  --line: #16121c;
  --shadow: 6px 6px 0 rgba(22, 18, 28, 0.9);
  --shadow-sm: 4px 4px 0 rgba(22, 18, 28, 0.9);
  --font-comic: "Bangers", "Mochiy Pop One", cursive;
  --font-pop: "Mochiy Pop One", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 2px 2px, rgba(22, 18, 28, 0.09) 1.6px, transparent 1.6px),
    linear-gradient(180deg, #ffe9b3 0%, var(--paper) 30%, #ffeec9 100%);
  background-size: 18px 18px, auto;
  font-family: "Noto Sans JP", sans-serif;
}

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

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

/* ---------- トップバー ---------- */

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 10px 14px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  color: #fffdf5;
  background: linear-gradient(135deg, var(--blue) 0 52%, var(--red) 52% 100%);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  transform: rotate(-3deg);
  font-family: var(--font-comic);
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-shadow: 1px 1px 0 var(--line);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--font-comic);
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.main-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav a {
  min-height: 40px;
  padding: 9px 13px;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  border-color: var(--line);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--line);
  transform: rotate(-1.5deg);
}

/* ---------- ヒーロー ---------- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  margin-top: 18px;
}

.intro-panel,
.panel,
.status-rail {
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  min-height: 520px;
  overflow: hidden;
}

.map-art {
  position: relative;
  min-height: 360px;
  border-right: 3px solid var(--line);
  background:
    repeating-conic-gradient(from 8deg at 50% 42%, rgba(255, 253, 245, 0.16) 0 7deg, transparent 7deg 16deg),
    radial-gradient(circle at 3px 3px, rgba(255, 253, 245, 0.28) 2px, transparent 2px),
    linear-gradient(140deg, var(--blue) 0%, var(--blue-dark) 55%, var(--purple) 100%);
  background-size: auto, 22px 22px, auto;
}

.map-art::before {
  position: absolute;
  top: 26px;
  left: 26px;
  z-index: 2;
  display: grid;
  width: 96px;
  height: 74px;
  place-items: center;
  content: "US-EN";
  border: 3px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--line);
  transform: rotate(-4deg);
  font-family: var(--font-comic);
  font-size: 1.6rem;
  letter-spacing: 0.05em;
}

.map-art::after {
  position: absolute;
  inset: auto 0 0 0;
  height: 32%;
  content: "";
  background: linear-gradient(transparent, rgba(22, 18, 28, 0.5));
}

.route-line {
  position: absolute;
  inset: 22% 12% 18% 14%;
  border: 3px dashed rgba(255, 253, 245, 0.85);
  border-left: 0;
  border-bottom: 0;
  border-radius: 50% 8px 50% 8px;
  transform: rotate(-18deg);
}

.pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255, 253, 245, 0.35);
}

.pin-a {
  top: 24%;
  left: 18%;
}

.pin-b {
  top: 52%;
  left: 52%;
  background: var(--yellow);
}

.pin-c {
  top: 28%;
  right: 18%;
  background: var(--green);
}

.orbit {
  position: absolute;
  border: 2px solid rgba(255, 253, 245, 0.5);
  border-radius: 50%;
}

.orbit-one {
  width: 190px;
  height: 190px;
  right: -42px;
  top: 38px;
}

.orbit-two {
  width: 130px;
  height: 130px;
  left: 34px;
  bottom: 54px;
}

.passport {
  position: absolute;
  left: 26px;
  bottom: 26px;
  z-index: 2;
  width: min(240px, calc(100% - 52px));
  padding: 18px 22px;
  border: 3px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 5px 5px 0 var(--line);
  transform: rotate(2deg);
}

.passport span {
  display: block;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.passport strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-comic);
  font-size: 2.4rem;
  letter-spacing: 0.04em;
}

.intro-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 60px);
}

.eyebrow {
  display: inline-block;
  width: fit-content;
  margin: 0 0 14px;
  padding: 5px 14px;
  border: 2.5px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--line);
  transform: skewX(-8deg) rotate(-1deg);
  font-family: var(--font-comic);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1,
h2 {
  font-family: var(--font-pop);
  font-weight: 400;
}

h1 {
  max-width: 18ch;
  font-size: clamp(1.8rem, 3.2vw, 2.9rem);
  line-height: 1.35;
  text-shadow: 3px 3px 0 var(--yellow);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.4;
}

h3 {
  font-family: var(--font-pop);
  font-weight: 400;
  font-size: 1.25rem;
}

.intro-copy > p:not(.eyebrow),
.section-heading > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.9;
  font-weight: 500;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ---------- ボタン ---------- */

.primary-link,
.ghost-button,
.submit-button,
.primary-button,
.icon-button {
  min-height: 48px;
  border: 3px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-link,
.submit-button,
.primary-button {
  display: inline-grid;
  place-items: center;
  padding: 0 20px;
  color: #fffdf5;
  background: var(--red);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  text-shadow: 1px 1px 0 rgba(22, 18, 28, 0.4);
}

.ghost-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  padding: 0 16px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.primary-link:hover,
.submit-button:hover,
.primary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translate(-2px, -2px) rotate(-1deg);
  box-shadow: 6px 6px 0 rgba(22, 18, 28, 0.9);
}

.primary-link:active,
.submit-button:active,
.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(22, 18, 28, 0.9);
}

/* ---------- ステータスレール ---------- */

.status-rail {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.metric {
  padding: 13px 15px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--line);
}

.metric:nth-child(1) {
  background: var(--yellow-soft);
  transform: rotate(-1deg);
}

.metric:nth-child(2) {
  background: #dff1ff;
  transform: rotate(1deg);
}

.metric:nth-child(3) {
  background: #ffe3e9;
  transform: rotate(-0.6deg);
}

.metric span,
.route-summary span,
.feedback-box > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-family: var(--font-comic);
  font-size: 2.1rem;
  letter-spacing: 0.04em;
}

.freeze-note {
  font-style: normal;
  font-size: 1.1rem;
}

.level-ring {
  position: relative;
  display: grid;
  width: min(100%, 210px);
  place-items: center;
  justify-self: center;
  aspect-ratio: 1;
}

.level-ring svg {
  width: 100%;
  transform: rotate(-90deg);
}

.level-ring circle {
  fill: none;
  stroke: rgba(22, 18, 28, 0.12);
  stroke-width: 13;
}

#xpRing {
  stroke: var(--red);
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.45s ease;
}

.ring-inner {
  position: absolute;
  display: grid;
  place-items: center;
  text-align: center;
}

.ring-inner strong {
  font-family: var(--font-comic);
  font-size: 2.2rem;
  letter-spacing: 0.04em;
}

.ring-inner small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

/* ---------- パネル共通 ---------- */

.panel {
  margin-top: 22px;
  padding: clamp(20px, 4vw, 38px);
}

.section-heading {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-bottom: 24px;
}

.section-heading.compact {
  max-width: none;
}

/* ---------- 診断 ---------- */

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

.choice-block,
.quiz-card,
.feedback-box,
.habit-card,
.vocab-bonus {
  min-width: 0;
  padding: 18px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.vocab-bonus {
  margin-top: 16px;
  background:
    radial-gradient(circle at 3px 3px, rgba(255, 199, 44, 0.16) 2.4px, transparent 2.4px);
  background-size: 16px 16px;
}

.vocab-bonus textarea {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

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

.vocab-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}

.vocab-list .vocab-list-ja {
  color: var(--muted);
  font-weight: 500;
  text-align: right;
}

fieldset {
  margin: 0;
}

legend,
.quiz-card label {
  margin-bottom: 12px;
  font-weight: 800;
}

.choice-block label,
.quiz-card label:has(input) {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--muted);
  font-weight: 600;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.quiz-card p,
.feedback-box p,
.habit-card p {
  color: var(--muted);
  line-height: 1.75;
}

select,
textarea {
  width: 100%;
  border: 3px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fffdf5;
  box-shadow: inset 3px 3px 0 rgba(22, 18, 28, 0.06);
}

select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.writing-check {
  grid-column: span 2;
}

.submit-button {
  grid-column: span 2;
  width: fit-content;
  font-size: 1.05rem;
}

/* ---------- 今日のメニュー ---------- */

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.route-summary > div {
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--blue);
  color: #fffdf5;
  box-shadow: var(--shadow-sm);
}

.route-summary > div:nth-child(2) {
  background: var(--red);
  transform: rotate(0.6deg);
}

.route-summary > div:nth-child(3) {
  background: var(--purple);
  transform: rotate(-0.6deg);
}

.route-summary span {
  color: rgba(255, 253, 245, 0.85);
}

.route-summary strong {
  display: block;
  margin-top: 7px;
  font-family: var(--font-pop);
  font-weight: 400;
}

.daily-plan {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.daily-task {
  min-height: 165px;
  padding: 16px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

button.daily-task {
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.daily-task:hover,
button.daily-task:focus-visible {
  transform: translate(-2px, -2px) rotate(-1deg);
  box-shadow: 7px 7px 0 rgba(22, 18, 28, 0.9);
}

button.daily-task:nth-child(odd) {
  transform: rotate(-0.8deg);
}

button.daily-task:nth-child(even) {
  transform: rotate(0.8deg);
}

.daily-task.is-done {
  background:
    radial-gradient(circle at 3px 3px, rgba(35, 196, 131, 0.25) 2px, transparent 2px),
    #eafff5;
  background-size: 14px 14px, auto;
}

.daily-task strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 1.02rem;
}

.daily-task p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.daily-task .tag {
  display: inline-flex;
  padding: 4px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: #fffdf5;
  background: var(--red);
  box-shadow: 2px 2px 0 var(--line);
  font-size: 0.76rem;
  font-weight: 800;
  text-shadow: 1px 1px 0 rgba(22, 18, 28, 0.35);
}

.daily-task.is-done .tag {
  background: var(--green);
}

/* ---------- 単語ラボ ---------- */

.vocab-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.vocab-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 26px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 3px 3px, rgba(40, 167, 233, 0.14) 2.4px, transparent 2.4px),
    #f2faff;
  background-size: 20px 20px, auto;
  box-shadow: var(--shadow-sm);
}

.vocab-meta {
  display: flex;
  gap: 8px;
}

.vocab-card > strong {
  font-family: var(--font-comic);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  letter-spacing: 0.03em;
  text-shadow: 3px 3px 0 var(--yellow);
}

.vocab-example {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 500;
}

.vocab-example-ja {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 500;
}

.vocab-answer {
  margin: 0;
  padding: 12px 16px;
  border: 2.5px solid var(--line);
  border-radius: 12px;
  background: var(--yellow-soft);
  box-shadow: 3px 3px 0 var(--line);
  font-weight: 800;
}

.vocab-tools {
  flex-wrap: wrap;
}

.choice-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.choice-button {
  padding: 12px 16px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.choice-button:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(22, 18, 28, 0.9);
}

.choice-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(22, 18, 28, 0.9);
}

.choice-button:disabled {
  cursor: default;
}

.choice-button.is-correct {
  background: var(--green);
  color: var(--ink);
}

.choice-button.is-wrong {
  background: var(--red);
  color: #fffdf5;
  text-shadow: 1px 1px 0 rgba(22, 18, 28, 0.35);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: #fffdf5;
  background: var(--red);
  box-shadow: 2px 2px 0 var(--line);
  font-size: 0.76rem;
  font-weight: 800;
  text-shadow: 1px 1px 0 rgba(22, 18, 28, 0.35);
}

.tag-soft {
  background: var(--blue);
}

/* ---------- スキルスタジオ ---------- */

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  min-height: 44px;
  padding: 0 16px;
  border: 3px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--line);
  cursor: pointer;
  font-family: var(--font-comic);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  transition: transform 0.12s ease;
}

.tab:hover {
  transform: translate(-1px, -1px) rotate(-1deg);
}

.tab.is-active {
  color: #fffdf5;
  background: var(--blue);
  transform: rotate(-1.5deg) scale(1.05);
  text-shadow: 1px 1px 0 rgba(22, 18, 28, 0.4);
}

.skill-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.skill-passage {
  margin: 14px 0 0;
  padding: 14px 18px;
  border: 2.5px solid var(--line);
  border-left-width: 8px;
  border-radius: 10px;
  background: var(--yellow-soft);
  box-shadow: 3px 3px 0 var(--line);
  line-height: 1.7;
  font-weight: 500;
}

.passage-ja {
  margin: 10px 0 0;
  padding: 12px 16px;
  border: 2.5px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  line-height: 1.8;
  font-weight: 500;
}

/* ---------- 単語タップ辞書 ---------- */

.tap-word {
  padding: 0 1px;
  border: 0;
  border-bottom: 2px dotted rgba(40, 167, 233, 0.5);
  border-radius: 3px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tap-word:hover {
  background: rgba(255, 199, 44, 0.45);
  border-bottom-color: var(--line);
}

.tap-word.is-active {
  background: var(--yellow);
  border-bottom-color: var(--line);
}

.word-popup {
  position: absolute;
  z-index: 60;
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: min(300px, calc(100vw - 24px));
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fffdf5;
  box-shadow: var(--shadow-sm);
}

.word-popup > strong {
  padding-right: 24px;
  font-family: var(--font-comic);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.word-popup > p {
  margin: 0;
  font-weight: 600;
  line-height: 1.6;
}

.word-popup > p.is-missing {
  color: var(--muted);
  font-weight: 500;
}

.word-popup-single {
  padding-top: 8px;
  border-top: 2px dashed rgba(22, 18, 28, 0.3);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

/* 熟語の一部である語は、まとまりが分かるよう下線をつなげて示す */
.tap-word.in-phrase {
  border-bottom: 2px solid rgba(233, 76, 96, 0.55);
}

.tap-word.in-phrase:hover,
.tap-word.in-phrase.is-active {
  background: rgba(233, 76, 96, 0.2);
  border-bottom-color: var(--red);
}

.word-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 2px 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.bonus-example-ja {
  color: var(--muted);
  font-weight: 500;
}

.hint-text {
  margin: 10px 0 0;
  padding: 12px 16px;
  border: 2.5px dashed var(--blue);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  line-height: 1.8;
  font-weight: 600;
}

.model-answer-ja {
  margin: 0 0 10px;
  padding-top: 10px;
  border-top: 2px dashed rgba(22, 18, 28, 0.35);
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.92rem;
  font-weight: 500;
}

.listen-row {
  margin-top: 14px;
  align-items: center;
}

.listen-note,
.mic-status {
  align-self: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.answer-tools {
  margin-top: 16px;
}

.tool-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.icon-button {
  width: 54px;
  padding: 0;
  font-size: 1.2rem;
}

/* 吹き出し型フィードバック */
.feedback-box {
  position: relative;
  border-radius: 18px;
  background: #fff;
}

.feedback-box::before {
  position: absolute;
  top: 42px;
  left: -19px;
  content: "";
  border: 11px solid transparent;
  border-right-color: var(--line);
}

.feedback-box::after {
  position: absolute;
  top: 44px;
  left: -12px;
  content: "";
  border: 9px solid transparent;
  border-right-color: #fff;
}

.stars {
  margin: 6px 0 0;
  color: var(--yellow);
  font-size: 2rem;
  letter-spacing: 0.12em;
  text-shadow: 2px 2px 0 rgba(22, 18, 28, 0.85);
}

.model-answer {
  margin-top: 14px;
  padding: 12px 14px;
  border: 2.5px dashed var(--line);
  border-radius: 12px;
  background: var(--yellow-soft);
}

.model-answer span {
  display: block;
  color: var(--red-dark);
  font-family: var(--font-comic);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.model-answer p {
  margin: 8px 0;
  line-height: 1.7;
  font-weight: 500;
}

.ghost-button.small {
  min-height: 38px;
  padding: 0 12px;
  border-width: 2.5px;
  font-size: 0.85rem;
}

/* ---------- 成長ボード ---------- */

.progress-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 16px;
}

.growth-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

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

.habit-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

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

.level-step {
  min-height: 120px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--line);
}

.level-step.is-current {
  color: var(--ink);
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 253, 245, 0.35) 0 8deg, transparent 8deg 18deg),
    var(--yellow);
  transform: rotate(-2deg) scale(1.06);
}

.level-step strong {
  display: block;
  font-family: var(--font-comic);
  font-size: 1.7rem;
  letter-spacing: 0.05em;
}

.level-step span {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.radar-ring {
  fill: none;
  stroke: rgba(22, 18, 28, 0.18);
  stroke-width: 1.5;
}

.radar-value {
  fill: rgba(255, 59, 92, 0.35);
  stroke: var(--red);
  stroke-width: 3;
  stroke-linejoin: round;
}

.radar-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.radar-label.small {
  font-size: 9px;
  fill: var(--muted);
}

.diag-bar {
  fill: var(--blue);
  stroke: var(--line);
  stroke-width: 2;
}

.chart-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin: 18px 0;
}

.day-dot {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
  background: #fff;
}

.day-dot.is-done {
  color: var(--ink);
  background: var(--green);
  box-shadow: 2px 2px 0 var(--line);
  transform: rotate(-3deg);
}

.day-dot.is-today {
  border-width: 3px;
  border-color: var(--red);
}

/* ---------- バッジ ---------- */

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

.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2.5px solid rgba(22, 18, 28, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  filter: grayscale(1);
  opacity: 0.5;
}

.badge.is-owned {
  filter: none;
  opacity: 1;
  border-color: var(--line);
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 201, 60, 0.25) 0 9deg, transparent 9deg 20deg),
    #fff;
  box-shadow: 3px 3px 0 var(--line);
  transform: rotate(-1deg);
}

.badge.is-owned:nth-child(even) {
  transform: rotate(1deg);
}

.badge-emoji {
  font-size: 1.35rem;
}

.badge-name {
  font-size: 0.8rem;
  font-weight: 800;
}

/* ---------- 履歴と比較 ---------- */

.history-block,
.settings-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 3px dashed var(--line);
}

.growth-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 14px 0;
}

.growth-compare:empty {
  display: none;
}

.compare-card {
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.8deg);
}

.compare-card.is-now {
  background:
    radial-gradient(circle at 3px 3px, rgba(255, 59, 92, 0.12) 2px, transparent 2px),
    #fff5f0;
  background-size: 14px 14px, auto;
  transform: rotate(0.8deg);
}

.compare-card span {
  display: block;
  color: var(--red-dark);
  font-size: 0.75rem;
  font-weight: 800;
}

.compare-card p {
  margin: 8px 0 0;
  line-height: 1.6;
  font-weight: 500;
}

.compare-arrow {
  color: var(--red);
  font-family: var(--font-comic);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transform: rotate(-4deg);
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  padding: 12px 16px;
  border: 2.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(22, 18, 28, 0.5);
}

.history-list .history-empty {
  color: var(--muted);
  line-height: 1.7;
}

.history-meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.history-list strong {
  display: block;
  margin: 4px 0;
}

.history-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 設定 ---------- */

.settings-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-top: 14px;
}

.setting-item {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
}

.setting-item select,
.setting-item input {
  min-height: 42px;
  padding: 0 10px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  background: #fffdf5;
  font-weight: 500;
}

.file-button {
  position: relative;
}

/* ---------- トースト & 演出 ---------- */

.toast-zone {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 60;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  width: min(92vw, 430px);
}

.toast {
  padding: 13px 18px;
  border: 3px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  text-align: center;
  animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.is-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) rotate(-2deg) scale(0.9); }
  to { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
}

.celebrate-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 14px;
  border: 1.5px solid var(--line);
  border-radius: 2px;
  animation: confetti-fall 2s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    top: 105%;
    transform: rotate(540deg);
  }
}

/* POW! バースト */
.pow-word {
  position: absolute;
  top: 38%;
  left: 50%;
  display: grid;
  place-items: center;
  min-width: 220px;
  min-height: 220px;
  padding: 30px;
  color: var(--red);
  background: var(--yellow);
  border: 4px solid var(--line);
  clip-path: polygon(
    50% 0%, 61% 12%, 76% 5%, 79% 21%, 95% 20%, 89% 35%, 100% 45%,
    88% 55%, 96% 70%, 80% 71%, 79% 88%, 64% 82%, 50% 95%, 38% 83%,
    22% 90%, 21% 73%, 5% 71%, 13% 56%, 0% 45%, 12% 36%, 6% 20%,
    22% 22%, 26% 6%, 39% 13%
  );
  transform: translate(-50%, -50%);
  font-family: var(--font-comic);
  font-size: 3.2rem;
  letter-spacing: 0.06em;
  text-shadow:
    2px 2px 0 var(--line),
    -1px -1px 0 var(--line),
    1px -1px 0 var(--line),
    -1px 1px 0 var(--line);
  animation: pow-pop 1.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pow-pop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-18deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.15) rotate(6deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  75% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.85) rotate(4deg); opacity: 0; }
}

/* ---------- 認証エリア・ログインモーダル ---------- */

.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-email {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 18, 28, 0.55);
}

.modal-box {
  position: relative;
  width: min(420px, 100%);
  padding: 30px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 2.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
  font-weight: 800;
}

.modal-box h3 {
  margin-right: 40px;
}

.modal-note {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.7;
  font-weight: 500;
  font-size: 0.92rem;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 800;
}

.auth-field input {
  min-height: 44px;
  padding: 0 12px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 500;
}

.modal-box .primary-button,
.modal-box .ghost-button {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 2px;
  content: "";
  background: var(--line);
  opacity: 0.2;
}

.auth-consent {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.auth-privacy-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.auth-status {
  margin: 0;
  min-height: 1.2em;
  color: var(--red-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 920px) {
  .workspace,
  .intro-panel,
  .skill-stage,
  .progress-grid,
  .vocab-stage,
  .growth-row,
  .growth-compare {
    grid-template-columns: 1fr;
  }

  .map-art {
    border-right: 0;
    border-bottom: 3px solid var(--line);
  }

  .status-rail,
  .ladder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .compare-arrow {
    text-align: center;
  }

  .feedback-box::before,
  .feedback-box::after {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .main-nav a {
    padding-inline: 10px;
  }

  .auth-area {
    width: 100%;
    justify-content: flex-start;
    margin-top: 10px;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.55rem, 7vw, 2.3rem);
  }

  .diagnostic-grid,
  .route-summary,
  .daily-plan,
  .status-rail,
  .ladder {
    grid-template-columns: 1fr;
  }

  .writing-check,
  .submit-button {
    grid-column: auto;
  }

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

  .pow-word {
    min-width: 170px;
    min-height: 170px;
    font-size: 2.3rem;
  }
}
