@font-face {
  font-family: "MapleStory";
  src: url("assets/maplestory/maplestory-light.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "MapleStory";
  src: url("assets/maplestory/maplestory-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #133a70;
  --muted: #52657f;
  --red: #ef6f75;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --motion-fast: 120ms;
  --motion-standard: 200ms;
  font-family: "MapleStory", "PingFang TC", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #72c8ed; }
body {
  display: flex;
  justify-content: center;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 44px 22px 36px;
  color: var(--ink);
  background: transparent;
}
button, input { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #ffad16; outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border: 2px solid #714900;
  border-radius: 5px;
  color: #3f2e08;
  background: #ffe894;
  font-weight: 700;
  transform: translateY(-150%);
  transition: transform var(--motion-fast) ease-out;
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.world-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #43b8ec url("assets/maplestory/maple-village-background-v1.png") center bottom / cover no-repeat;
}
.world-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(113,208,247,.025), rgba(35,119,89,.02));
}
.app-shell {
  width: min(1120px, 80vw);
  overflow: hidden;
  align-self: flex-start;
  border: 3px solid #223943;
  border-radius: 10px;
  background: #e8edf0;
  box-shadow: 0 0 0 1px #8ba0aa, inset 0 0 0 1px #f5fafc, 0 12px 30px rgba(18,44,55,.38);
}
.topbar {
  position: relative;
  display: grid;
  place-items: center;
  height: 32px;
  border-bottom: 1px solid #13282f;
  color: #d5c47b;
  background: linear-gradient(#3f535d 0%, #2a3f49 45%, #1d3039 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.25), inset 0 -1px rgba(0,0,0,.35);
  font-size: 13px;
  text-shadow: 0 1px #101a20;
}
.window-title { font-weight: 700; letter-spacing: .04em; }
.sync-state {
  display: block;
  position: absolute;
  left: 11px;
  max-width: 250px;
  overflow: hidden;
  color: #bed0d6;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .72;
}
.sync-state i { display: none; }
.window-controls { position: absolute; right: 6px; display: flex; gap: 4px; }
.window-controls i {
  display: grid;
  place-items: center;
  width: 21px;
  height: 19px;
  border: 1px solid #14272f;
  border-radius: 4px;
  color: #eef6f8;
  background: linear-gradient(#526772, #2b414b);
  box-shadow: inset 0 1px rgba(255,255,255,.25);
  font: 700 13px/1 sans-serif;
}

.workspace { min-width: 0; }
.side-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 2px;
  padding: 5px 6px 4px;
  border-bottom: 1px solid #9faeb6;
  background: linear-gradient(#dfe5e8, #c7d0d5);
  box-shadow: inset 0 1px #f8fbfc, 0 2px 3px rgba(34,57,67,.18);
}
.nav-item {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 5px 4px;
  border: 1px solid #8898a0;
  border-radius: 4px 4px 2px 2px;
  color: #33454e;
  background: linear-gradient(#fafafa 0%, #d7dadd 48%, #bfc5c9 100%);
  box-shadow: inset 0 1px #fff, 0 1px rgba(255,255,255,.7);
  font-size: 14px;
  cursor: pointer;
  text-shadow: 0 1px #fff;
}
.nav-item:hover { filter: brightness(1.035); }
.nav-item:active { transform: translateY(1px); }
.nav-item.is-active {
  border-color: #c68f31;
  color: #6a4a0e;
  background: linear-gradient(#fff0a4 0%, #f6c953 48%, #dca735 100%);
  box-shadow: inset 0 1px #fff7cf, 0 0 0 1px #fff2b6;
}
.nav-item span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 9px;
  color: #4a5961;
  background: rgba(255,255,255,.55);
  font-size: 11px;
}
.nav-item:disabled {
  color: #65737a;
  background: linear-gradient(#edf0f1, #d4dadd);
  opacity: .58;
  cursor: not-allowed;
  filter: saturate(.35);
}

.main-area {
  min-width: 0;
  padding: 11px 11px calc(10px + var(--safe-bottom));
  background: linear-gradient(90deg, #dce3e7, #f7f9fa 4%, #f7f9fa 96%, #dce3e7);
  box-shadow: inset 0 0 0 1px #fff;
}
.notice { margin: 0 0 8px; padding: 8px 10px; border: 1px solid #d26870; border-radius: 4px; color: #8e3038; background: #fff0f1; font-weight: 700; }
.page-heading { display: none; }
.next-action {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr) 190px;
  align-items: center;
  gap: 12px;
  min-height: 91px;
  padding: 10px 15px;
  border: 1px solid #bec8ce;
  border-radius: 4px;
  background: linear-gradient(110deg, #fbfcfd 0%, #fff 58%, #eef3f5 100%);
  box-shadow: inset 0 0 0 2px #e7ecef, 0 1px 2px rgba(34,63,75,.2);
}
.action-check {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  border: 2px solid #d48912;
  border-radius: 50%;
  color: #4d3909;
  background: radial-gradient(circle at 34% 26%, #fff597 0 10%, #ffd84f 38%, #f4a40d 72%, #d77b05 100%);
  box-shadow: inset 0 0 0 2px #fff2a7, 0 2px 2px rgba(72,54,8,.3);
  font: 700 34px/1 sans-serif;
  text-shadow: 0 1px #fff5a6;
}
.action-copy { min-width: 0; }
.action-copy small, .action-copy strong, .action-copy span { display: block; }
.action-copy small { color: #4177a7; font-size: 13px; }
.action-copy strong { overflow: hidden; margin: 2px 0 1px; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.action-copy span { color: #63758b; font-size: 13px; }
.action-go {
  min-height: 52px;
  padding: 7px 16px;
  border: 2px solid #bf7608;
  border-radius: 5px;
  color: #3f2e08;
  background: linear-gradient(#ffd56b 0%, #ffb31f 42%, #ee8a05 100%);
  box-shadow: inset 0 0 0 2px #ffeaa3, 0 2px 0 #8f5706;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px #fff4bd;
}
.action-go:hover { filter: brightness(1.05); }
.action-go:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px #ffeaa3; }

.section-block { margin-top: 9px; }
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin: 0;
  padding: 3px 8px;
  border-bottom: 1px solid #c7d0d5;
  background: linear-gradient(90deg, #f0f4f6, rgba(255,255,255,.2));
}
.collapsible-section > summary { list-style: none; cursor: pointer; }
.collapsible-section > summary::-webkit-details-marker { display: none; }
.section-heading h2 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 18px; }
.section-heading h2::before { content: "▤"; color: #93621b; font-size: 20px; }
.section-heading span { color: #4f6282; font-size: 15px; font-weight: 700; }
.collapse-chevron { margin-left: auto; font-style: normal; transition: transform var(--motion-standard) ease; }
.collapsible-section[open] .collapse-chevron { transform: rotate(180deg); }
.focus-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding-top: 4px; }
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 228px;
  padding: 10px 10px 9px;
  border: 1px solid #bcc7cd;
  border-radius: 4px;
  color: var(--ink);
  background: linear-gradient(#fbfcfd, #f2f6f8);
  box-shadow: inset 0 0 0 2px #e4eaee, 0 1px 2px rgba(32,60,72,.15);
  text-align: left;
}
.project-card.priority-1 { border-color: #93b0c0; box-shadow: inset 0 0 0 2px #d8e6ed, 0 1px 2px rgba(32,60,72,.18); }
.project-card:has(.card-open:hover), .project-card:has(.card-open:focus-visible) { border-color: #6e91a3; box-shadow: inset 0 0 0 2px #d8e6ed, 0 3px 8px rgba(32,60,72,.2); }
.card-head { display: grid; grid-template-columns: 47px minmax(0,1fr); grid-template-rows: auto auto; align-items: center; gap: 3px 7px; min-height: 47px; }
.project-icon { display: grid; place-items: center; width: 45px; height: 45px; border: 1px solid #b8c4cb; border-radius: 4px; background: #fff; box-shadow: inset 0 0 0 1px #edf2f4; }
.project-icon { grid-row: 1 / 3; }
.project-icon img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.priority-chip {
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid #88b7e8;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(#80c2ff, #3d88dd);
  box-shadow: inset 0 1px rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px #3572aa;
}
.project-name { min-width: 0; overflow-wrap: anywhere; font-size: 16px; line-height: 1.35; }
.health-chip { padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.health-chip.red { color: #9d2731; background: #ffc9cd; }
.health-chip.yellow { color: #765100; background: #ffe797; }
.health-chip.green { color: #176640; background: #c6f2c5; }
.health-chip.pending { color: #675d76; background: #e4deec; }
.stage-line { margin: 7px 1px 5px; color: #62738b; font-size: 12px; }
.progress-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.progress-rail {
  display: block;
  width: 100%;
  height: 15px;
  overflow: hidden;
  appearance: none;
  border: 2px solid #405159;
  border-radius: 2px;
  background: linear-gradient(#65747a, #27383f 52%, #17252b);
  box-shadow: inset 0 1px rgba(255,255,255,.2), 0 1px #fff;
}
.progress-rail::-webkit-progress-bar { background: linear-gradient(#65747a, #27383f 52%, #17252b); }
.progress-rail::-webkit-progress-value { border-right: 1px solid #819515; background: linear-gradient(#edff6d 0%, #cbea24 45%, #91c90e 54%, #b4e51a 100%); box-shadow: inset 0 1px rgba(255,255,255,.6); }
.progress-rail::-moz-progress-bar { border-right: 1px solid #819515; background: linear-gradient(#edff6d 0%, #cbea24 45%, #91c90e 54%, #b4e51a 100%); box-shadow: inset 0 1px rgba(255,255,255,.6); }
.progress-row b { font-size: 16px; }
.deadline { margin: 7px 0 6px; color: #4d6382; font-size: 12px; }
.next-box { margin-top: auto; min-height: 49px; padding: 7px 9px; border: 1px solid #bfd8ea; border-radius: 4px; background: linear-gradient(#eef9ff, #dceef9); box-shadow: inset 0 1px #fff; }
.next-box small, .next-box strong { display: block; }
.next-box small { margin-bottom: 2px; color: #557397; font-size: 11px; }
.next-box strong { overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; }
.card-open {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border: 1px solid #526b78;
  border-radius: 3px;
  color: #f5f7f8;
  background: linear-gradient(#899aa3, #566b77 51%, #40545f);
  box-shadow: inset 0 1px rgba(255,255,255,.45), 0 1px #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px #263942;
  cursor: pointer;
}

.attention-panel { overflow: hidden; border: 1px solid #bcc6cb; border-radius: 4px; background: #f6f8f9; box-shadow: inset 0 0 0 2px #e7ecef; }
.attention-item {
  display: grid;
  grid-template-columns: 145px minmax(180px,1.3fr) minmax(170px,1fr) 112px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 5px 10px;
  border-bottom: 1px solid #d3dade;
  background: rgba(255,255,255,.66);
}
.attention-item:last-child { border-bottom: 0; }
.attention-tag { display: inline-flex; justify-content: center; width: fit-content; min-width: 132px; padding: 5px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.attention-tag.red { color: #9f2430; background: #ffc9ce; }
.attention-tag.yellow { color: #6f4b00; background: #ffe8a5; }
.attention-tag.pending { color: #335e91; background: #d8eafa; }
.attention-item strong { overflow-wrap: anywhere; font-size: 13px; line-height: 1.35; }
.attention-item small { overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.35; }
.tiny-button { min-height: 44px; padding: 6px 12px; border: 1px solid #6496cb; border-radius: 4px; color: #174a86; background: linear-gradient(#f7fbff, #dceafa); box-shadow: inset 0 1px #fff, 0 1px #c7d4df; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.tiny-button:hover { filter: brightness(1.04); }
.empty-state { padding: 18px; color: var(--muted); text-align: center; }

.other-projects { margin-top: 8px; border: 1px solid #aebbc2; border-radius: 4px; background: #f5f8f9; }
.other-projects summary { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 9px; min-height: 44px; padding: 6px 11px; list-style: none; cursor: pointer; }
.other-projects summary::-webkit-details-marker { display: none; }
.other-projects summary > span { font-size: 18px; }
.other-projects summary b { color: #5d6f84; font-size: 12px; font-weight: 400; }
.other-projects summary i { transition: transform var(--motion-standard) ease; }
.other-projects[open] summary i { transform: rotate(180deg); }
.other-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; padding: 0 7px 7px; }
.other-card { min-height: 44px; padding: 10px; border: 1px solid #c3cdd2; border-radius: 4px; background: #fff; cursor: pointer; text-align: left; }
.other-card strong, .other-card span { display: block; }
.other-card span { margin: 5px 0; color: var(--muted); font-size: 11px; }

.page-footer { display: flex; justify-content: space-between; gap: 12px; margin: 8px 4px 0; color: #6d7c88; font-size: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; min-width: 260px; padding: 12px 16px; border: 2px solid #4a6977; border-radius: 5px; color: #153a4b; background: #f8fbfc; box-shadow: 0 6px 18px rgba(25,52,63,.28); font-weight: 700; }

.back-button, .outline-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 7px 12px; border: 1px solid #688a9a; border-radius: 4px; color: #174a79; background: linear-gradient(#fbfdfe, #dfe8ec); box-shadow: inset 0 1px #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.back-button { margin-bottom: 8px; }
.back-button span { font-size: 22px; line-height: 0; }
.detail-hero { display: grid; grid-template-columns: 74px minmax(0,1fr); gap: 14px; overflow: hidden; padding: 14px; border: 1px solid #aebbc2; border-radius: 4px; background: linear-gradient(#fbfcfd, #eef3f5); box-shadow: inset 0 0 0 2px #e2e9ec; }
.detail-icon { width: 72px; height: 72px; }
.detail-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.detail-copy { min-width: 0; }
.detail-copy small { color: #42749d; }
.detail-copy h1 { margin: 4px 0; font-size: 26px; }
.detail-copy p { max-width: 720px; margin: 0; color: #586d84; }
.detail-progress { display: grid; grid-template-columns: minmax(160px,460px) auto; align-items: center; gap: 10px; margin-top: 10px; }
.detail-progress b { font-size: 16px; }
.facts-row { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin: 8px 0; }
.fact { padding: 9px 11px; border: 1px solid #bdc8ce; border-radius: 4px; background: #f8fafb; }
.fact small, .fact strong { display: block; }
.fact small { margin-bottom: 3px; color: var(--muted); }
.stage-title { margin: 13px 0 7px; font-size: 18px; }
.stage-timeline { position: relative; display: grid; gap: 7px; }
.stage-timeline::before { content: ""; position: absolute; top: 22px; bottom: 22px; left: 18px; width: 3px; background: #9fb5c0; }
.stage-card { position: relative; margin-left: 43px; }
.stage-card::before { content: ""; position: absolute; top: 18px; left: -32px; z-index: 2; width: 12px; height: 12px; border: 3px solid #edf2f4; border-radius: 50%; background: #7f9ead; box-shadow: 0 0 0 1px #5c7783; }
.stage-card.current::before { background: #f1be2d; box-shadow: 0 0 0 1px #b57b12; }
.stage-card.complete::before { background: #96ce25; box-shadow: 0 0 0 1px #668f13; }
.stage-card details { overflow: hidden; border: 1px solid #bbc6cc; border-radius: 4px; background: #f8fafb; }
.stage-card.current details { border-color: #c29a39; }
.stage-card summary { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 9px; min-height: 51px; padding: 8px 12px; list-style: none; cursor: pointer; }
.stage-card summary::-webkit-details-marker { display: none; }
.stage-card summary strong, .stage-card summary small { display: block; }
.stage-card summary small { margin-top: 2px; color: var(--muted); }
.stage-status { padding: 4px 8px; border-radius: 9px; background: #e8eef1; font-size: 11px; }
.stage-card.current .stage-status { color: #765408; background: #ffedae; }
.stage-card.complete .stage-status { color: #3d6814; background: #d7efb1; }
.stage-body { padding: 0 12px 12px; border-top: 1px solid #d5dce0; }
.stage-objective { margin: 9px 0; color: #4f6780; }
.task-list { display: grid; gap: 5px; }
.task-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid #ccdae1; border-radius: 4px; background: #eef6fa; }
.task-dot { display: grid; place-items: center; width: 21px; height: 21px; border: 2px solid #6e9eba; border-radius: 50%; background: #fff; }
.task-row.done { opacity: .65; }
.task-row.done .task-dot { color: #fff; border-color: #72a11d; background: #9ed22d; }
.task-row small { color: var(--muted); white-space: nowrap; }
.completion-gate { margin-top: 8px; padding: 9px; border-left: 4px solid #d5a432; background: #fff6d7; color: #725c28; }

@media (max-width: 900px) {
  body { padding: 18px 10px; }
  .app-shell { width: calc(100vw - 20px); }
  .sync-state { display: none; }
  .focus-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 0; }
  .attention-item { grid-template-columns: 132px minmax(180px,1fr) auto; }
  .attention-item small { display: none; }
  .other-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { padding: 60px 10px 16px; }
  .world-backdrop { background-position: 8% top; }
  .app-shell { width: calc(100vw - 20px); max-width: 100%; border-width: 2px; }
  .topbar { height: 30px; }
  .side-nav { grid-template-columns: repeat(3,minmax(0,1fr)); overflow: hidden; }
  .nav-item { min-height: 44px; font-size: 14px; }
  .nav-item b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main-area, #project-view, .focus-grid, .project-card, .attention-panel { min-width: 0; max-width: 100%; }
  .main-area { overflow: hidden; padding: 7px; }
  .next-action { grid-template-columns: 48px minmax(0,1fr); gap: 9px; padding: 9px; }
  .action-check { width: 43px; height: 43px; font-size: 30px; }
  .action-copy small, .action-copy span { font-size: 14px; }
  .action-copy strong { font-size: 18px; line-height: 1.35; white-space: normal; }
  .action-go { grid-column: 1 / -1; min-height: 48px; font-size: 16px; }
  .section-heading h2 { font-size: 16px; }
  .section-heading { min-height: 44px; }
  .card-head { grid-template-columns: 47px minmax(0,1fr); }
  .progress-row { grid-template-columns: minmax(0,1fr) auto; }
  .attention-item { grid-template-columns: 1fr auto; gap: 5px 8px; }
  .stage-line, .deadline { font-size: 14px; }
  .priority-chip, .health-chip { font-size: 12px; }
  .next-box small { font-size: 12px; }
  .next-box strong { font-size: 15px; }
  .card-open, .tiny-button { font-size: 14px; }
  .attention-tag { grid-column: 1; min-width: 0; }
  .attention-tag { font-size: 13px; }
  .attention-item strong { grid-column: 1 / -1; font-size: 15px; }
  .tiny-button { grid-column: 2; grid-row: 1; }
  .other-grid, .facts-row { grid-template-columns: 1fr; }
  .page-footer { display: grid; gap: 3px; }
  .page-footer { font-size: 12px; line-height: 1.45; }
  .detail-hero { grid-template-columns: 56px minmax(0,1fr); gap: 9px; padding: 10px; }
  .detail-icon { width: 54px; height: 54px; }
  .detail-copy h1 { font-size: 20px; }
  .detail-progress { grid-template-columns: 1fr auto; }
  .stage-card { margin-left: 35px; }
  .stage-timeline::before { left: 14px; }
  .stage-card::before { left: -27px; }
  .stage-card summary { grid-template-columns: minmax(0,1fr) auto; }
  .stage-card summary > i { display: none; }
  .task-row { grid-template-columns: auto minmax(0,1fr); }
  .task-row small { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
