@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;600;700&family=Fraunces:opsz,wght@9..144,700;9..144,800&display=swap');

:root {
  color-scheme: light;
  --ink: #173e3c;
  --cream: #fff8dd;
  --moss: #306c55;
  --gold: #f3b94c;
  --coral: #ef765d;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: #70b9b1;
  color: var(--ink);
  font-family: "DM Sans", ui-rounded, system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
}
button { font: inherit; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hud {
  position: fixed; z-index: 5; inset: 22px 28px auto;
  display: grid; grid-template-columns: 240px minmax(320px, 450px) 190px;
  justify-content: space-between; align-items: start; gap: 18px;
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fffdf1; filter: drop-shadow(0 2px 7px #23483c55); }
.brand-mark {
  display: grid; place-items: center; width: 47px; height: 47px; border: 2px solid #fff9d6;
  border-radius: 50% 50% 47% 53%; background: #2f6d57; box-shadow: inset 0 0 0 3px #2f6d57, inset 0 0 0 4px #eaca70;
  font: 800 27px/1 "Fraunces", Georgia, serif; color: #f8d978;
}
.brand small, .brand strong { display: block; letter-spacing: .13em; }
.brand small { font-size: 9px; font-weight: 700; opacity: .83; margin-bottom: 1px; }
.brand strong { font: 800 20px/1 "Fraunces", Georgia, serif; letter-spacing: .035em; }

.rounds {
  justify-self: center; width: min(100%, 450px); padding: 13px 18px 14px;
  border: 1px solid #fff8d375; border-radius: 15px;
  background: linear-gradient(120deg, #fffbeded, #fff6d8e8);
  box-shadow: 0 8px 28px #294f3c35, inset 0 1px #fff;
  backdrop-filter: blur(9px);
}
.rounds-top { display: flex; justify-content: space-between; font-size: 9px; font-weight: 800; letter-spacing: .15em; color: #6f785b; }
.rounds-top b { color: #cc704f; }
.rounds h2 { margin: 4px 0 0; font: 800 20px/1.08 "Fraunces", Georgia, serif; color: #214b43; }
.rounds p { margin: 3px 0 9px; color: #657564; font-size: 11px; }
.task-pips { display: flex; gap: 5px; }
.task-pips i { height: 4px; flex: 1; border-radius: 6px; background: #c9cbb3; box-shadow: inset 0 1px 2px #596d5430; transition: .35s; }
.task-pips i.done { background: #ed9b5d; }
.task-pips i.current { background: #edc55d; animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { filter: brightness(1.18); box-shadow: 0 0 0 2px #edc55d38; } }

.day-card {
  justify-self: end; display: flex; gap: 9px; align-items: center; padding: 9px 13px;
  border: 1px solid #fff7cf99; border-radius: 13px; color: #fffdf1;
  background: #356a5b9c; box-shadow: 0 5px 18px #244c3c32; backdrop-filter: blur(8px);
}
.day-card .sun { color: #ffda69; font-size: 24px; filter: drop-shadow(0 2px #9a6b2255); }
.day-card small, .day-card b { display: block; }
.day-card small { font-size: 8px; font-weight: 800; letter-spacing: .13em; opacity: .8; }
.day-card b { font: 700 14px "Fraunces", Georgia, serif; }

.wayfinder {
  position: fixed; z-index: 6; left: 28px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
  color: #fffdea; border-radius: 12px; background: #1c4c42b8; border: 1px solid #fff6cf55;
  box-shadow: 0 5px 18px #173e3835; backdrop-filter: blur(6px); pointer-events: none; transition: opacity .25s;
}
.wayfinder > span {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: #efb553; color: #285044; font-size: 21px; font-weight: 900;
}
.wayfinder small, .wayfinder b, .wayfinder em { display: block; }
.wayfinder small { font-size: 8px; letter-spacing: .13em; font-weight: 800; color: #f3cf70; }
.wayfinder b { max-width: 150px; font: 700 13px "Fraunces", Georgia, serif; }
.wayfinder em { margin-top: 1px; font: normal 7px/1.1 "DM Sans", sans-serif; letter-spacing: .1em; opacity: .72; }

.prompt {
  position: fixed; z-index: 8; left: 50%; bottom: 80px; transform: translate(-50%, 18px) scale(.97);
  display: flex; gap: 12px; align-items: center; min-width: 300px; padding: 10px 15px 10px 10px;
  border: 1px solid #fff4bd; border-radius: 15px; color: #fffbe8; background: #153f39e8;
  box-shadow: 0 9px 28px #153c354c; backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: .2s;
}
.prompt.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.key { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: #f1bb57; color: #234b43; box-shadow: inset 0 -3px #b97539; font-weight: 900; }
.prompt div { flex: 1; }
.prompt small, .prompt b { display: block; }
.prompt small { color: #efc86c; font-size: 8px; letter-spacing: .13em; font-weight: 800; }
.prompt b { margin: 1px 0 5px; font: 700 14px "Fraunces", Georgia, serif; }
.prompt i { display: block; height: 4px; overflow: hidden; border-radius: 4px; background: #7c9585; }
.prompt i span { display: block; width: 0; height: 100%; border-radius: inherit; background: #f0bb53; transition: width .08s linear; }

.toast {
  position: fixed; z-index: 10; left: 50%; top: 115px; transform: translate(-50%, -22px);
  display: flex; align-items: center; gap: 11px; padding: 11px 18px 11px 11px; border-radius: 14px;
  color: #245145; background: #fff7dced; border: 1px solid #fff; box-shadow: 0 12px 35px #254c3e42;
  opacity: 0; pointer-events: none; transition: .35s cubic-bezier(.2,.9,.2,1.2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast > span { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; background: #e9b84f; color: white; font-weight: 900; }
.toast small, .toast b { display: block; }
.toast small { font-size: 8px; letter-spacing: .12em; font-weight: 800; color: #b06a49; }
.toast b { font: 700 14px "Fraunces", Georgia, serif; }

.controls-hint {
  position: fixed; z-index: 5; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; padding: 7px 13px; border-radius: 11px;
  background: #16443ba8; color: #f7f0d7; font-size: 9px; letter-spacing: .03em; backdrop-filter: blur(7px); pointer-events: none;
}
kbd { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-right: 2px; border-radius: 5px; color: #295348; background: #fff7db; box-shadow: 0 2px #b8a979; font: 800 10px "DM Sans", sans-serif; }
.round-button { position: fixed; z-index: 9; right: 28px; bottom: 22px; width: 40px; height: 40px; border: 1px solid #fff7cf88; border-radius: 50%; background: #285d50bf; color: #fff7d3; cursor: pointer; }
.journal-button {
  position: fixed; z-index: 9; right: 80px; bottom: 19px; display: flex; align-items: center; gap: 9px; min-width: 185px; height: 47px; padding: 6px 9px;
  border: 1px solid #fff5c988; border-radius: 14px; color: #fffbe8; background: #26584ec9; box-shadow: 0 6px 21px #183e3638; backdrop-filter: blur(7px); cursor: pointer; text-align: left;
}
.journal-button > span { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #e8b653; color: #2c5a4e; font-size: 21px; }
.journal-button small, .journal-button b { display: block; }
.journal-button small { font-size: 7px; letter-spacing: .13em; color: #eacb79; }
.journal-button b { max-width: 98px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 12px "Fraunces", Georgia, serif; }
.journal-button em { margin-left: auto; min-width: 22px; text-align: center; color: #f6cf65; font: normal 800 14px "DM Sans", sans-serif; }

.journal-shade { position: fixed; z-index: 29; inset: 0; background: #102f2a77; opacity: 0; visibility: hidden; backdrop-filter: blur(4px); transition: .3s; }
.journal-shade.show { opacity: 1; visibility: visible; }
.journal {
  position: fixed; z-index: 30; left: 50%; top: 50%; width: min(1000px, calc(100% - 38px)); max-height: min(760px, calc(100% - 38px)); overflow: auto;
  padding: 27px; border: 2px solid #edca74; border-radius: 25px; color: #244d44; background: #fff8e7f7;
  box-shadow: 0 28px 100px #143b356b, inset 0 0 0 5px #fffdf3; transform: translate(-50%, -47%) scale(.97); opacity: 0; visibility: hidden; transition: .35s cubic-bezier(.2,.8,.2,1); scrollbar-color: #d0a960 transparent;
}
.journal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }
.journal-head { display: flex; justify-content: space-between; align-items: start; padding: 3px 4px 17px; border-bottom: 1px solid #d8caa7; }
.journal-head small { color: #bb714e; font-size: 8px; font-weight: 800; letter-spacing: .18em; }
.journal-head h2 { margin: 2px 0 3px; font: 800 27px "Fraunces", Georgia, serif; }
.journal-head p { margin: 0; color: #718071; font-size: 11px; }
.journal-head button { width: 34px; height: 34px; border: 1px solid #cbbd98; border-radius: 50%; color: #49685d; background: #fffbed; cursor: pointer; font-size: 22px; }
.rank-row { display: grid; grid-template-columns: 54px minmax(180px, 1fr) auto; align-items: center; gap: 13px; margin: 18px 3px; padding: 13px 16px; border-radius: 14px; background: #e9edcf; border: 1px solid #d2d6b2; }
.rank-seal { display: grid; place-items: center; width: 50px; height: 50px; border: 4px solid #fff8df; border-radius: 50%; color: #f1ce67; background: #34705a; font-size: 27px; }
.rank-row small, .rank-row b, .rank-row i, .rank-row em { display: block; }
.rank-row > div > small { color: #738367; font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.rank-row b { font: 800 17px "Fraunces", Georgia, serif; }
.rank-row i { width: min(320px, 100%); height: 5px; margin: 4px 0; overflow: hidden; border-radius: 6px; background: #bcc6a5; }
.rank-row i span { display: block; height: 100%; background: #e8ae4a; transition: width .4s; }
.rank-row em { color: #778474; font: normal 8px "DM Sans", sans-serif; }
.rank-row > strong { color: #bb714c; font: 800 25px "Fraunces", Georgia, serif; }
.rank-row > strong small { font: 800 7px "DM Sans", sans-serif; letter-spacing: .12em; }
.growth-branches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.branch { --branch: #70a064; position: relative; padding: 13px 11px 12px; border: 1px solid #ded1ae; border-radius: 16px; background: #fffdf3; overflow: hidden; }
.branch::before { content: ""; position: absolute; top: 48px; bottom: 25px; left: 29px; width: 2px; background: #d6d2b8; }
.branch-head { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.branch-head span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: var(--branch); font-size: 17px; }
.branch-head small, .branch-head b { display: block; }
.branch-head small { font-size: 6px; font-weight: 800; letter-spacing: .13em; color: #83907b; }
.branch-head b { font: 800 14px "Fraunces", Georgia, serif; }
.branch-node { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 7px; align-items: center; min-height: 46px; margin: 6px 0; padding: 5px 6px; border-radius: 10px; color: #8b9184; background: #f2f0e5; border: 1px solid #e4e0cd; }
.branch-node > span { position: relative; z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; border: 2px solid #dedac6; border-radius: 50%; background: #f8f5e9; font-size: 11px; }
.branch-node small, .branch-node b { display: block; }
.branch-node small { font-size: 6px; letter-spacing: .09em; font-weight: 800; }
.branch-node b { font: 700 10px "Fraunces", Georgia, serif; }
.branch-node.unlocked { color: #335d50; background: color-mix(in srgb, var(--branch) 12%, #fffdf2); border-color: color-mix(in srgb, var(--branch) 38%, #e7d7b2); }
.branch-node.unlocked > span { color: white; border-color: #fff8dd; background: var(--branch); box-shadow: 0 0 0 2px var(--branch); }
.branch-node.next { color: #566d5f; background: #fffae8; border-style: dashed; border-color: #d5b45e; }
.branch-node.next > span { color: #bb843b; border-color: #e5c975; background: #fff6d1; }
.journal-note { display: flex; gap: 11px; align-items: center; margin: 14px 3px 0; padding: 10px 14px; border: 1px dashed #cea859; border-radius: 12px; color: #6b735f; background: #fff5d7; }
.journal-note > span { color: #dc984b; font-size: 21px; }
.journal-note p { margin: 0; font-size: 9px; line-height: 1.45; }
.journal-note b { color: #8c5c45; }

.start-card {
  position: fixed; z-index: 20; left: 50%; top: 50%; width: min(520px, calc(100% - 34px)); padding: 38px 56px 34px;
  transform: translate(-50%, -47%) scale(.97); text-align: center; color: #214a43;
  border: 2px solid #f9dd8a; border-radius: 42% 42% 24px 24px / 50px 50px 24px 24px;
  background: linear-gradient(150deg, #fffdf0f5, #fff3ceeF); box-shadow: 0 25px 90px #173d365c, inset 0 0 0 5px #fff9df;
  opacity: 0; visibility: hidden; transition: .55s cubic-bezier(.16,.8,.18,1); backdrop-filter: blur(9px);
}
.start-card.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.start-card::after { content: ""; position: absolute; inset: 11px; border: 1px solid #cfa95672; border-radius: 38% 38% 17px 17px / 43px 43px 17px 17px; pointer-events: none; }
.start-leaf { position: absolute; top: 56px; color: #5b8a61; font-size: 35px; }
.start-leaf.left { left: 38px; transform: rotate(-24deg); }
.start-leaf.right { right: 38px; transform: scaleX(-1) rotate(-24deg); }
.eyebrow { margin: 0 0 10px; color: #a56a49; font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.title-mark { width: 62px; height: 62px; padding: 4px; margin: 0 auto 7px; border-radius: 50%; border: 1px solid #d4a94f; }
.title-mark span { display: grid; width: 100%; height: 100%; place-items: center; border-radius: 50%; color: #f6cf64; background: #34715a; font: 800 34px "Fraunces", Georgia, serif; }
.start-card h1 { margin: 0; color: #285a4e; font: 800 clamp(42px, 7vw, 66px)/.9 "Fraunces", Georgia, serif; letter-spacing: -.045em; }
.start-card h2 { margin: 11px 0 17px; color: #cf7652; font-size: 11px; letter-spacing: .3em; }
.intro { max-width: 385px; margin: 0 auto 22px; color: #607362; font: 600 13px/1.6 "DM Sans", sans-serif; }
.start-card button:not(.text-button) {
  position: relative; z-index: 2; border: 0; border-radius: 10px; padding: 13px 18px; color: #fffbe6; background: #d96e50;
  box-shadow: 0 4px 0 #9f503c, 0 8px 15px #9f503c3b; font-size: 10px; font-weight: 800; letter-spacing: .12em; cursor: pointer;
}
.start-card button span { padding-left: 12px; font-size: 15px; }
.start-controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; color: #6a7868; font-size: 9px; }
.start-controls b { color: #315e50; }
.start-controls i { height: 20px; width: 1px; background: #cfc59e; }
.complete-card h1 { font-size: 48px; margin: 12px 0; }
.complete-seal { position: relative; display: grid; place-items: center; width: 70px; height: 70px; margin: 4px auto; border-radius: 50%; color: white; background: #e8b64f; border: 5px solid #fff2bf; font-size: 30px; }
.complete-seal i { position: absolute; inset: -10px; border: 1px dashed #c88946; border-radius: 50%; }
.text-button { position: relative; z-index: 2; display: block; margin: 16px auto 0; border: 0; color: #9d654d; background: transparent; font-size: 10px; text-decoration: underline; cursor: pointer; }

.touch-controls { display: none; }

@media (max-width: 820px) {
  .hud { inset: 10px 12px auto; grid-template-columns: 1fr auto; }
  .brand { transform: scale(.82); transform-origin: top left; }
  .rounds { grid-column: 1 / 3; grid-row: 2; width: min(96vw, 440px); padding: 9px 13px 10px; }
  .rounds h2 { font-size: 16px; }
  .rounds p { margin-bottom: 6px; }
  .day-card { transform: scale(.82); transform-origin: top right; }
  .wayfinder { left: 10px; top: auto; bottom: 148px; transform: scale(.84); transform-origin: bottom left; }
  .controls-hint { display: none; }
  .round-button { right: 12px; top: 114px; bottom: auto; width: 36px; height: 36px; }
  .journal-button { right: 12px; bottom: 12px; min-width: 0; width: 48px; padding: 6px; border-radius: 50%; }
  .journal-button > span { width: 34px; height: 34px; border-radius: 50%; }
  .journal-button div, .journal-button em { display: none; }
  .journal { padding: 18px 14px; max-height: calc(100% - 24px); width: calc(100% - 20px); }
  .journal-head h2 { font-size: 21px; }
  .rank-row { grid-template-columns: 45px 1fr; padding: 10px; }
  .rank-row > strong { display: none; }
  .growth-branches { grid-template-columns: 1fr 1fr; }
  .prompt { bottom: 112px; min-width: 275px; }
  .touch-controls { position: fixed; z-index: 9; display: flex; left: 14px; right: 14px; bottom: max(12px, env(safe-area-inset-bottom)); justify-content: space-between; align-items: end; pointer-events: none; }
  .touch-controls button { width: 51px; height: 51px; border: 1px solid #fff8d477; border-radius: 14px; color: #fffce7; background: #214f46b8; box-shadow: 0 4px 15px #173c3542; backdrop-filter: blur(5px); pointer-events: auto; touch-action: none; font-weight: 900; }
  .touch-move { display: flex; gap: 5px; align-items: end; }
  .touch-move span { display: flex; flex-direction: column; gap: 4px; }
  .touch-move span button { width: 45px; height: 39px; }
  .touch-help { border-radius: 50% !important; background: #d66e52dd !important; font-size: 9px; }
  .start-card { padding: 29px 28px 25px; }
  .start-leaf { display: none; }
}

@media (max-width: 520px) {
  .growth-branches { grid-template-columns: 1fr; }
  .journal-head p { display: none; }
}

@media (max-height: 620px) {
  .hud { top: 10px; }
  .rounds { padding-block: 8px; }
  .rounds p { display: none; }
  .start-card { padding-top: 25px; padding-bottom: 22px; }
  .title-mark { width: 48px; height: 48px; }
  .title-mark span { font-size: 26px; }
  .start-card h1 { font-size: 43px; }
  .start-card h2 { margin: 7px 0 10px; }
  .intro { margin-bottom: 13px; line-height: 1.4; }
  .start-controls { margin-top: 14px; }
}
