@import url("https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+KuaiLe&display=swap");

:root {
  --ink: #294238;
  --muted: #6e786c;
  --paper: #fbf4dc;
  --paper-deep: #e7ddb1;
  --green: #47745b;
  --green-dark: #315441;
  --coral: #e97857;
  --gold: #f0c85b;
  --sky: #b9ddd3;
  --shadow: rgba(49, 65, 45, .16);
  color: var(--ink);
  background: #dce8c8;
  font-family: "ZCOOL KuaiLe", "Hiragino Sans GB", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: linear-gradient(160deg, var(--sky) 0 34%, #e7e8bd 71%, #d9e5c3 100%); user-select: none; -webkit-tap-highlight-color: transparent; }
button, a { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 4px solid rgba(233, 120, 87, .55); outline-offset: 4px; }
.paper-grain { position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: .22; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.76' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E"); }
.screen { display: none; }
.screen.is-active { display: block; animation: enter .45s ease both; }
.schulte-app { position: relative; z-index: 1; width: min(1120px, calc(100% - 36px)); margin: auto; padding: 24px 0 54px; }

.welcome-nav { min-height: 54px; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px dashed rgba(47, 84, 65, .18); }
.back-link { color: #456451; font-size: 14px; text-decoration: none; }
.rule-chip { padding: 7px 13px; border: 3px solid rgba(255,255,255,.68); border-radius: 18px 8px; color: var(--green-dark); background: rgba(251,244,220,.72); box-shadow: 0 4px 0 rgba(57,74,47,.09); font-size: 15px; letter-spacing: .12em; }
.welcome-layout { min-height: 535px; display: grid; grid-template-columns: .82fr 1.18fr; align-items: center; gap: clamp(40px, 8vw, 110px); padding: 54px 5%; }
.welcome-copy { position: relative; z-index: 2; }
.kicker { margin: 0 0 12px; color: var(--green); font-size: 13px; letter-spacing: .16em; }
.welcome-copy h1 { margin: 0; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: clamp(74px, 9vw, 112px); font-weight: 400; line-height: .82; letter-spacing: -.03em; text-shadow: 0 5px rgba(255,255,255,.45); }
.welcome-copy h1 em { color: var(--coral); font-style: normal; }
.intro { max-width: 430px; margin: 28px 0 25px; color: #52655b; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 16px; line-height: 1.85; }
.primary-button { min-width: 250px; min-height: 68px; padding: 8px 10px 8px 24px; display: inline-flex; align-items: center; justify-content: space-between; gap: 22px; border: 0; border-radius: 23px 37px; color: white; background: var(--coral); box-shadow: 0 8px 0 #bc5d43, 0 15px 26px rgba(91,66,43,.16); cursor: pointer; transition: transform .16s, box-shadow .16s; }
.primary-button span { font-size: 22px; }
.primary-button i { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: var(--coral); background: white; font-size: 24px; font-style: normal; }
.primary-button:hover { transform: translateY(-3px); box-shadow: 0 11px 0 #bc5d43, 0 20px 30px rgba(91,66,43,.19); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 #bc5d43; }
.gentle-note { margin: 20px 0 0; color: #758074; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 11px; }

.preview-card { position: relative; width: min(100%, 500px); aspect-ratio: 1; overflow: hidden; padding: clamp(48px, 7vw, 70px); justify-self: center; border: 10px solid rgba(255,255,255,.7); border-radius: 48px 18px 48px 18px; background: rgba(247,238,202,.86); box-shadow: 0 16px 0 rgba(65,84,51,.1), 0 30px 55px rgba(47,76,57,.18); transform: rotate(2deg); }
.preview-card::before { content: ""; position: absolute; inset: 22px; border: 2px dashed rgba(70,88,57,.2); border-radius: 30px 11px; }
.preview-grid { position: relative; height: 100%; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.preview-grid i { display: grid; place-items: center; border: 4px solid white; border-radius: 18px 7px; color: #3d5848; background: #fffaf0; box-shadow: 0 5px 0 rgba(75,73,46,.1); font-family: Georgia, "Times New Roman", serif; font-size: clamp(22px, 4vw, 38px); font-style: normal; font-weight: 700; }
.preview-grid i:nth-child(2) { color: white; background: var(--coral); transform: translateY(-5px) rotate(-2deg); }
.preview-target { position: absolute; z-index: 3; right: 19px; top: 16px; width: 72px; height: 72px; display: grid; place-items: center; border: 4px solid white; border-radius: 50%; color: white; background: var(--green); box-shadow: 0 5px 0 rgba(45,64,44,.17); transform: rotate(6deg); }
.preview-target small { align-self: end; font-size: 9px; }
.preview-target b { align-self: start; font-family: Georgia, serif; font-size: 30px; }
.pencil-line { position: absolute; left: 9%; bottom: 8%; width: 28%; border-top: 4px solid var(--coral); border-radius: 50%; transform: rotate(-9deg); opacity: .65; }

.history-card { padding: clamp(24px, 5vw, 50px); border: 8px solid rgba(255,255,255,.58); border-radius: 34px 72px 34px 72px; background: rgba(251,244,220,.74); box-shadow: 0 12px 0 rgba(69,82,47,.09), 0 24px 45px rgba(60,76,48,.1); }
.history-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.history-heading p { margin: 0 0 5px; color: #73816f; font-size: 11px; letter-spacing: .1em; }
.history-heading h2 { margin: 0; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: clamp(38px, 5vw, 56px); font-weight: 400; }
.text-button { padding: 8px 12px; border: 1px solid rgba(63,84,63,.24); border-radius: 13px; color: #6d766b; background: transparent; font-size: 11px; cursor: pointer; }
.history-empty { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 15px; border: 3px dashed rgba(77,100,74,.2); border-radius: 25px 10px; text-align: center; }
.history-empty span { color: rgba(71,116,91,.35); font-family: Georgia, serif; font-size: 46px; letter-spacing: .1em; }
.history-empty p { margin: 0; color: #798277; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.summary-grid article { min-height: 105px; padding: 18px; display: flex; flex-direction: column; justify-content: center; border: 4px solid white; border-radius: 23px 9px; background: #eee6c7; box-shadow: 0 5px 0 rgba(76,72,43,.09); }
.summary-grid article.latest { background: #cfe1c1; }
.summary-grid article.best { background: #f3d576; transform: rotate(1deg); }
.summary-grid small { color: #6c786a; font-size: 10px; }
.summary-grid b { margin-top: 7px; color: var(--green-dark); font-family: Georgia, "Times New Roman", serif; font-size: clamp(23px, 4vw, 35px); white-space: nowrap; }
.trend-card { margin: 22px 0; padding: 19px 22px 13px; border: 4px solid white; border-radius: 25px 10px; background: rgba(255,250,232,.88); box-shadow: 0 6px 0 rgba(72,71,45,.08); }
.trend-card figcaption { display: flex; justify-content: space-between; gap: 15px; }
.trend-card figcaption b { font-size: 17px; font-weight: 400; }
.trend-card figcaption span { color: #7d8275; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 10px; }
.trend-card svg { width: 100%; height: auto; min-height: 150px; overflow: visible; }
.chart-grid { stroke: #cfd3bb; stroke-width: 1; stroke-dasharray: 5 6; }
.chart-area { fill: url(#trendFill); }
.chart-line { fill: none; stroke: var(--coral); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--paper); stroke: var(--coral); stroke-width: 4; }
.chart-label { fill: #53665a; font: 700 14px Georgia, serif; text-anchor: middle; }
.history-list-wrap { max-height: 350px; overflow: auto; border: 3px solid rgba(255,255,255,.75); border-radius: 20px 8px; background: rgba(255,250,235,.62); }
table { width: 100%; border-collapse: collapse; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 12px; }
th, td { padding: 13px 16px; border-bottom: 1px dashed rgba(81,96,74,.18); text-align: left; }
th { position: sticky; top: 0; color: #687565; background: #eee7c9; font-size: 10px; font-weight: 500; }
th:nth-child(n+2), td:nth-child(n+2) { text-align: right; }
td:nth-child(2) { color: var(--green-dark); font-family: Georgia, serif; font-size: 16px; font-weight: 700; }
.record-best { color: #b86643; }

.game-screen { min-height: calc(100vh - 48px); }
.game-header { min-height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; border-bottom: 2px dashed rgba(47,84,65,.18); }
.round-button { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,.7); border-radius: 50%; color: var(--green); background: rgba(251,244,220,.78); box-shadow: 0 4px 0 rgba(60,76,48,.1); font-size: 30px; cursor: pointer; }
.game-title { text-align: center; }
.game-title small { color: #6d7a6d; font-size: 9px; letter-spacing: .13em; }
.game-title h1 { margin: 2px 0 0; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: 31px; font-weight: 400; }
.timer { justify-self: end; min-width: 115px; padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; border: 3px solid white; border-radius: 20px 8px; color: var(--green-dark); background: rgba(251,244,220,.78); box-shadow: 0 4px 0 rgba(60,76,48,.1); }
.timer small { grid-column: 1/-1; color: #748073; font-size: 8px; }
.timer b { font-family: Georgia, serif; font-size: 25px; }
.timer i { margin-left: 3px; font-size: 9px; font-style: normal; }
.target-strip { width: min(620px, 100%); min-height: 78px; margin: 22px auto 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 13px; padding: 9px 18px; border: 5px solid white; border-radius: 27px 11px; color: #52665a; background: #d6e2bd; box-shadow: 0 6px 0 rgba(73,87,54,.11); }
.target-strip > span { justify-self: end; font-size: 14px; }
.target-strip b { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--coral); box-shadow: 0 4px 0 #bd5f46; font-family: Georgia, serif; font-size: 30px; }
.target-strip small { color: #6e7a6d; font-family: Georgia, serif; font-size: 13px; }
.number-grid { width: min(620px, calc(100vh - 250px), 100%); margin: auto; padding: 12px; display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; border: 8px solid rgba(255,255,255,.72); border-radius: 32px 13px; background: rgba(226,214,166,.78); box-shadow: 0 12px 0 rgba(65,78,47,.11), 0 24px 44px rgba(54,75,53,.14); }
.number-cell { min-width: 0; aspect-ratio: 1; border: 3px solid white; border-radius: 19px 7px; color: #304a3d; background: #fffaf0; box-shadow: 0 5px 0 rgba(75,72,44,.12); font-family: Georgia, "Times New Roman", serif; font-size: clamp(19px, 4.6vw, 34px); font-weight: 700; cursor: pointer; transition: transform .12s, color .2s, background .2s, box-shadow .12s; touch-action: manipulation; }
.number-cell:hover:not(:disabled) { transform: translateY(-3px); border-color: #fff2bd; }
.number-cell:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(75,72,44,.12); }
.number-cell:disabled { opacity: 1; color: #304a3d; background: #fffaf0; cursor: default; }
.number-cell.current-hit { border-color: #d94f3e; box-shadow: inset 0 0 0 2px #fffaf0, 0 5px 0 rgba(123,55,43,.18); }
.number-cell.correct-now { animation: correct .35s cubic-bezier(.2,1.45,.4,1); }
.number-cell.wrong { animation: shake .35s ease; border-color: #e98768; background: #fff0d4; }
.game-feedback { min-height: 34px; margin: 18px auto 0; color: #5f7064; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 12px; text-align: center; }

.complete-overlay { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(37,63,48,.65); backdrop-filter: blur(7px); }
.complete-overlay[hidden] { display: none; }
.complete-card { width: min(440px, 100%); padding: 38px 30px 32px; border: 8px solid #fff2c5; border-radius: 45px 18px; background: var(--paper); box-shadow: 0 19px 0 rgba(35,52,34,.16), 0 35px 70px rgba(27,46,33,.28); text-align: center; animation: resultIn .55s cubic-bezier(.2,1.35,.4,1) both; }
.complete-card h2 { margin: 0; color: var(--coral); font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: 62px; font-weight: 400; }
.finish-time { margin: 18px auto 14px; display: flex; justify-content: center; align-items: baseline; gap: 7px; color: var(--green-dark); }
.finish-time b { font-family: Georgia, serif; font-size: 64px; }
.finish-time span { font-size: 15px; }
.complete-card > p:not(.kicker) { margin: 0 auto 24px; color: #657266; font-family: "Hiragino Sans GB", "PingFang SC", sans-serif; font-size: 13px; line-height: 1.7; }
.complete-actions { display: grid; gap: 14px; justify-items: center; }
.secondary-button { min-height: 45px; border: 0; color: var(--green); background: transparent; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

@keyframes enter { from { opacity: 0; transform: translateY(12px); } }
@keyframes correct { 50% { transform: translateY(-6px) scale(1.08) rotate(-2deg); } }
@keyframes shake { 25% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }
@keyframes resultIn { from { opacity: 0; transform: scale(.72) rotate(-3deg); } }

@media (max-width: 760px) {
  .schulte-app { width: min(100% - 20px, 660px); padding-top: 12px; }
  .welcome-layout { min-height: auto; grid-template-columns: 1fr; gap: 42px; padding: 42px 8px 52px; }
  .welcome-copy { text-align: center; }
  .intro { margin-left: auto; margin-right: auto; }
  .preview-card { width: min(88vw, 430px); }
  .history-card { padding: 24px 14px 30px; border-width: 5px; border-radius: 27px 45px 27px 45px; }
  .history-heading { align-items: center; }
  .summary-grid { gap: 7px; }
  .summary-grid article { min-height: 90px; padding: 11px 9px; border-width: 3px; }
  .trend-card { padding: 15px 8px 8px; }
  .trend-card figcaption { padding: 0 8px; }
  th, td { padding: 11px 9px; }
  .game-screen { min-height: calc(100vh - 24px); }
  .number-grid { gap: 3px; padding: 4px; border-width: 4px; border-radius: 24px 10px; }
  .number-cell { border-width: 2px; border-radius: 14px 5px; box-shadow: 0 4px 0 rgba(75,72,44,.12); }
}

@media (max-width: 430px) {
  .preview-card { display: none; }
  .welcome-layout { padding-top: 48px; }
  .welcome-copy h1 { font-size: 70px; }
  .history-heading p { display: none; }
  .summary-grid b { font-size: 19px; }
  .trend-card figcaption span { display: none; }
  .game-header { grid-template-columns: 50px 1fr auto; gap: 7px; }
  .game-title small { display: none; }
  .game-title h1 { font-size: 25px; }
  .timer { min-width: 88px; padding: 7px 8px; }
  .timer b { font-size: 21px; }
  .target-strip { min-height: 66px; margin-top: 14px; padding: 6px 12px; border-width: 4px; }
  .target-strip b { width: 48px; height: 48px; font-size: 27px; }
  .number-cell { font-size: clamp(17px, 6vw, 24px); }
  .complete-card { padding-left: 18px; padding-right: 18px; }
}

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