:root {
  --k12-paper: #fff8f1;
  --k12-surface: #ffffff;
  --k12-ink: #3b281d;
  --k12-muted: #876f61;
  --k12-line: #efd7c6;
  --k12-accent: #f47b2a;
  --k12-accent-dark: #a94716;
  --k12-accent-pale: #fff2e7;
  --k12-gold: #d69211;
  --k12-silver: #9d9792;
  --k12-bronze: #aa6b46;
  --k12-body: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --k12-data: "DIN Alternate", "Arial Narrow", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #f3e7dc; }
body { min-width: 280px; min-height: 100%; margin: 0; overflow-x: hidden; background: #f3e7dc; color: var(--k12-ink); font-family: var(--k12-body); -webkit-font-smoothing: antialiased; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(244, 123, 42, .48); outline-offset: 3px; }
h1, h2, p, blockquote, figure { margin: 0; }

.k12-app { position: relative; width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; overflow: clip; padding-bottom: calc(92px + env(safe-area-inset-bottom)); background: var(--k12-paper); box-shadow: 0 22px 58px rgba(112, 53, 22, .14); }
.k12-titlebar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; min-height: 52px; border-bottom: 1px solid rgba(239, 215, 198, .9); background: rgba(255, 248, 241, .94); backdrop-filter: blur(15px); }
.k12-titlebar h1 { font-size: 16px; font-weight: 750; text-align: center; }
.k12-back { display: grid; height: 44px; place-items: center; color: var(--k12-accent-dark); font-size: 32px; line-height: 1; text-decoration: none; }
.k12-content { padding: 14px 14px 34px; }

.k12-hero { position: relative; height: 226px; overflow: hidden; border-radius: 24px 24px 24px 8px; background: #8e3c1a; box-shadow: 0 14px 32px rgba(118, 53, 24, .2); }
.k12-hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 57% center; }
.k12-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(49, 25, 17, .68), rgba(58, 25, 12, .25) 44%, rgba(58, 25, 12, .01) 75%), linear-gradient(0deg, rgba(39, 20, 13, .3), transparent 50%); }
.k12-hero blockquote { position: absolute; left: 23px; bottom: 24px; color: white; text-shadow: 0 2px 14px rgba(40, 17, 8, .46); }
.k12-hero blockquote strong { display: block; font-family: "Songti SC", "STSong", var(--k12-body); font-size: 28px; line-height: 1.25; letter-spacing: .04em; }
.k12-hero blockquote cite { display: block; margin-top: 9px; color: rgba(255, 255, 255, .86); font-size: 11px; font-style: normal; letter-spacing: .08em; }

.k12-period-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 15px; padding: 4px; border: 1px solid var(--k12-line); border-radius: 15px; background: #f9e8da; }
.k12-period-tabs button { min-width: 0; min-height: 42px; border: 0; border-radius: 11px; background: transparent; color: #987561; font-size: 14px; font-weight: 750; text-align: center; }
.k12-period-tabs button.is-active { background: white; color: var(--k12-accent-dark); box-shadow: 0 5px 14px rgba(133, 62, 25, .1); }
.k12-period-control { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; min-height: 56px; margin-top: 11px; overflow: hidden; border: 1px solid var(--k12-line); border-radius: 15px; background: white; }
.k12-date-arrow { border: 0; background: white; color: var(--k12-accent-dark); font-size: 27px; text-align: center; }
.k12-date-arrow:disabled { color: #d8c6b9; cursor: default; }
.k12-selected-period { min-width: 0; border: 0; border-right: 1px solid #f2dfd1; border-left: 1px solid #f2dfd1; background: white; }
.k12-selected-period strong { display: block; overflow: hidden; font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.k12-selected-period:disabled { color: var(--k12-ink); cursor: default; }
.k12-status { min-height: 18px; margin: 12px 4px -4px; color: var(--k12-muted); font-size: 11px; }
.k12-status:empty { display: none; }
.k12-status[data-tone="error"] { color: #a23c24; }
.k12-status[data-tone="demo"] { color: var(--k12-accent-dark); }

.k12-ranking-list { margin: 14px 0 0; padding: 0 15px; border: 1px solid var(--k12-line); border-radius: 20px; background: white; list-style: none; box-shadow: 0 10px 28px rgba(111, 55, 26, .055); }
.k12-rank-row { display: grid; grid-template-columns: 39px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 66px; border-bottom: 1px solid #f2e2d7; }
.k12-rank-row:last-child { border-bottom: 0; }
.k12-rank-number { color: #b49785; font-family: var(--k12-data); font-size: 18px; font-weight: 850; letter-spacing: -.03em; }
.k12-top-1 .k12-rank-number, .k12-top-1 .k12-rank-count strong { color: var(--k12-gold); }
.k12-top-2 .k12-rank-number, .k12-top-2 .k12-rank-count strong { color: var(--k12-silver); }
.k12-top-3 .k12-rank-number, .k12-top-3 .k12-rank-count strong { color: var(--k12-bronze); }
.k12-competitor { display: flex; align-items: center; min-width: 0; gap: 7px; }
.k12-competitor strong { min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; }
.k12-competitor span { flex: none; padding: 3px 6px; border-radius: 7px; background: var(--k12-accent-pale); color: var(--k12-accent-dark); font-family: var(--k12-data); font-size: 10px; font-weight: 700; }
.k12-rank-count { display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; color: var(--k12-muted); white-space: nowrap; }
.k12-rank-count strong { color: var(--k12-accent-dark); font-family: var(--k12-data); font-size: 23px; line-height: 1; }
.k12-rank-count span { font-size: 10px; }
.k12-empty { margin-top: 14px; padding: 34px 18px; border: 1px solid var(--k12-line); border-radius: 20px; background: white; text-align: center; }
.k12-empty strong { font-size: 15px; }
.k12-join { position: fixed; z-index: 15; right: max(16px, calc((100vw - 520px) / 2 + 16px)); bottom: calc(17px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 7px; min-height: 50px; padding: 0 18px 0 14px; border: 1px solid #8b3511; border-radius: 25px 25px 25px 8px; background: var(--k12-accent-dark); color: white; box-shadow: 0 12px 28px rgba(131, 49, 15, .32); font-size: 14px; font-weight: 800; text-decoration: none; }
.k12-join span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .16); font-family: var(--k12-data); font-size: 17px; }

.k12-calendar { position: fixed; z-index: 40; inset: auto 0 0; width: min(100%, 520px); margin: 0 auto; padding: 0; border: 0; border-radius: 25px 25px 0 0; background: white; color: var(--k12-ink); box-shadow: 0 -18px 48px rgba(81, 38, 18, .2); }
.k12-calendar::backdrop { background: rgba(67, 32, 17, .42); backdrop-filter: blur(2px); }
.k12-calendar form { padding: 10px 19px calc(22px + env(safe-area-inset-bottom)); }
.k12-sheet-handle { width: 38px; height: 4px; margin: 0 auto 14px; border-radius: 4px; background: #e4d5cb; }
.k12-sheet-head { display: flex; align-items: center; justify-content: space-between; }
.k12-sheet-head h2 { font-size: 22px; }
.k12-sheet-head button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--k12-accent-pale); color: var(--k12-accent-dark); font-size: 24px; }
.k12-calendar-month { margin-top: 17px; text-align: center; }
.k12-weekdays, .k12-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.k12-weekdays { margin-top: 16px; color: #a88e7d; font-size: 11px; }
.k12-calendar-grid { margin-top: 7px; gap: 4px 0; }
.k12-calendar-grid button, .k12-calendar-grid span { display: grid; aspect-ratio: 1; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--k12-ink); font-family: var(--k12-data); font-size: 13px; }
.k12-calendar-grid button { background: var(--k12-accent-pale); color: var(--k12-accent-dark); font-weight: 800; }
.k12-calendar-grid button.is-selected { background: var(--k12-accent-dark); color: white; box-shadow: 0 5px 12px rgba(152, 61, 21, .24); }
.k12-calendar-grid .is-unavailable { color: #c9b8ad; }

.k12-join-app { padding-bottom: 0; background: linear-gradient(180deg, #fff8f1, #fff2e8); }
.k12-join-content { min-height: calc(100dvh - 52px); padding: 34px 18px 40px; }
.k12-join-heading { position: relative; padding: 25px 23px 29px; overflow: hidden; border-radius: 25px 25px 25px 8px; background: linear-gradient(145deg, #8e3612, #ed7125); color: white; box-shadow: 0 16px 34px rgba(133, 52, 18, .22); }
.k12-join-heading::after { position: absolute; right: -34px; top: -38px; width: 150px; height: 150px; border: 22px solid rgba(255, 218, 150, .18); border-radius: 50%; content: ""; }
.k12-join-heading > span { position: relative; z-index: 1; color: #ffe6cd; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.k12-join-heading h2 { position: relative; z-index: 1; max-width: 290px; margin-top: 10px; font-size: 34px; line-height: 1.2; letter-spacing: -.045em; }
.k12-article-stack { display: grid; gap: 14px; margin-top: 18px; }
.k12-article-choice { position: relative; display: flex; min-height: 210px; flex-direction: column; padding: 22px 22px 20px 72px; overflow: hidden; border: 1px solid var(--k12-line); border-radius: 21px 21px 21px 7px; background: white; color: var(--k12-ink); text-decoration: none; box-shadow: 0 10px 25px rgba(102, 50, 24, .065); }
.k12-article-choice::after { position: absolute; right: -39px; bottom: -54px; width: 120px; height: 120px; border: 16px solid var(--k12-accent-pale); border-radius: 50%; content: ""; }
.k12-article-number { position: absolute; left: 20px; top: 22px; color: #e8c3a8; font-family: var(--k12-data); font-size: 25px; font-weight: 850; }
.k12-article-type { align-self: flex-start; padding: 5px 9px; border-radius: 14px; background: #ffe7d3; color: var(--k12-accent-dark); font-size: 11px; font-weight: 800; }
.k12-article-choice > strong { position: relative; z-index: 1; max-width: 300px; margin-top: 13px; font-size: 18px; line-height: 1.48; letter-spacing: -.02em; }
.k12-article-summary { position: relative; z-index: 1; margin-top: 8px; color: var(--k12-muted); font-size: 12px; }
.k12-article-open { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 18px; color: var(--k12-accent-dark); font-size: 13px; font-weight: 800; }
.k12-article-open i { font-size: 17px; font-style: normal; }

@media (min-width: 700px) {
  body { padding: 28px 0; }
  .k12-app { min-height: calc(100dvh - 56px); border: 1px solid #e6cfbf; border-radius: 19px; }
  .k12-titlebar { border-radius: 19px 19px 0 0; }
  .k12-calendar { bottom: 28px; border-radius: 25px; }
}

@media (max-width: 360px) {
  .k12-hero { height: 210px; }
  .k12-hero blockquote strong { font-size: 25px; }
  .k12-ranking-list { padding: 0 11px; }
  .k12-rank-row { grid-template-columns: 35px minmax(0, 1fr) auto; gap: 7px; }
  .k12-competitor { gap: 5px; }
  .k12-competitor strong { font-size: 13px; }
  .k12-rank-count strong { font-size: 21px; }
  .k12-article-choice { padding-left: 65px; }
}

@media (prefers-reduced-motion: no-preference) {
  .k12-period-tabs button, .k12-join, .k12-article-choice { transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease; }
  .k12-join:active, .k12-article-choice:active { transform: translateY(2px); }
}
