:root {
  color-scheme: dark;
  --ground: #151b17;
  --panel: #1e2821;
  --inset: #242f26;
  --line: #344237;
  --ink: #f2ecdb;
  --muted: #acb5a2;
  --gold: #efba6d;
  --green: #abd087;
  --display: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', Arial, sans-serif;
  font: 16px/1.4 var(--sans);
  color: var(--ink);
  background: var(--ground);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 53% 2%, #263127 0, var(--ground) 49rem); }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, canvas:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
a { color: inherit; }
[hidden] { display: none !important; }
.shell { width: min(1480px, calc(100% - 64px)); margin-inline: auto; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 5; padding: .5rem 1rem; background: var(--panel); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.topbar { border-bottom: 1px solid #354034; background: #171e19; }
.topbar-inner { display: flex; min-height: 66px; justify-content: space-between; align-items: center; gap: .8rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.46rem/1 var(--display); white-space: nowrap; text-decoration: none; }
.brand img { image-rendering: pixelated; background: #302d22; border: 1px solid #574631; border-radius: 8px; padding: 4px; }
.brand span span { color: var(--gold); }
.top-actions { display: flex; align-items: center; gap: .8rem; }
.online { color: var(--green); display: flex; align-items: center; gap: .5rem; font-size: .83rem; white-space: nowrap; }
.online.offline { color: var(--muted); }
.signal { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 9px #9fcb7045; }
.outline, .primary, .profile { border: 1px solid #435144; border-radius: 6px; padding: .5rem .65rem; background: #29352a; font-weight: 600; font-size: .84rem; transition: background .15s, border-color .15s, transform .15s; }
.outline:not(:disabled):hover, .profile:hover { background: #344437; border-color: #65765f; transform: translateY(-1px); }
.outline:not(:disabled):active, .primary:active, .profile:active, .job:active, .blueprint:active { transform: translateY(1px); }
.outline:disabled { opacity: .59; }
.outline.compact { padding: .42rem .65rem; }
.primary { background: var(--gold); border-color: #f6d297; color: #242013; }
.primary:hover { background: #f6d297; }
.profile { display: flex; align-items: center; gap: .42rem; max-width: 14rem; }
.profile:disabled { opacity: .65; }
.profile [data-icon] { width: 18px; height: 18px; flex: none; }
#profile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding-block: 25px 36px; }
[data-enter] { animation: enter .5s ease-out both; }
@keyframes enter { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.world-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.eyebrow { display: flex; align-items: center; gap: .6rem; color: var(--gold); font: 700 .75rem/1.25 var(--sans); letter-spacing: .13em; text-transform: uppercase; margin-bottom: 6px; }
.small-diamond { display: inline-block; width: 7px; height: 7px; transform: rotate(45deg); background: currentColor; flex: none; }
h1 { font: 700 clamp(2.15rem, 4.6vw, 3.5rem)/.99 var(--display); letter-spacing: -.052em; text-wrap: balance; }
.day { display: flex; min-width: 141px; flex: none; align-items: center; gap: .62rem; background: #222b21; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 7px; }
.day [data-icon] { display: block; width: 31px; height: 31px; }
.day strong, .day small { display: block; }
.day strong { font-size: .93rem; }
.day small { color: var(--muted); font-size: .74rem; }

.stockbar { display: grid; grid-template-columns: minmax(140px, .95fr) repeat(4, 1fr); margin-bottom: 16px; padding: 4px 0; background: #202a22; border: 1px solid var(--line); border-radius: 8px; }
.stock-title, .stock-item { min-height: 62px; display: flex; align-items: center; padding: .4rem 1rem; gap: .65rem; }
.stock-title { flex-direction: column; align-items: start; justify-content: center; gap: 1px; font-weight: 700; }
.stock-item { border-left: 1px solid #364438; }
.stockbar small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
.stockbar strong { font: 700 1.5rem/1.08 var(--display); font-variant-numeric: tabular-nums; }
.stockbar .coins strong { color: var(--gold); }
.item-icon { width: 38px; height: 38px; padding: 5px; display: inline-grid; place-items: center; border-radius: 7px; flex: none; border: 1px solid #47533c; background: #303b2b; }
.item-icon.wood { background: #3a3325; border-color: #514734; }
.item-icon.stone { background: #303a38; border-color: #424e4b; }
.item-icon.food { background: #39372a; border-color: #504a36; }
.item-icon.coin { background: #3d3523; border-color: #57492b; }
[data-icon] > canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.game-grid { display: grid; grid-template-columns: minmax(192px, .92fr) minmax(390px, 2.95fr) minmax(213px, 1fr); gap: 15px; align-items: start; }
.left-pane, .center-pane, .right-pane { min-width: 0; display: grid; gap: 14px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.panel-heading { display: flex; min-height: 46px; align-items: center; justify-content: space-between; gap: .6rem; padding: .52rem .85rem; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font: 700 1.15rem/1.2 var(--display); }
.heading-icon { width: 22px; height: 22px; opacity: .84; flex: none; }
.vitals { padding: .72rem .83rem .6rem; display: grid; gap: .6rem; }
.vital span { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.vital b { color: var(--ink); font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
progress { appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: 2px; background: #111913; overflow: hidden; color: var(--meter, var(--gold)); }
progress::-webkit-progress-bar { background: #111913; }
progress::-webkit-progress-value { background: var(--meter, var(--gold)); transition: width .24s ease; }
progress::-moz-progress-bar { background: var(--meter, var(--gold)); }
.health { --meter: #d27e73; }
.energy { --meter: #9abd72; }
.hunger { --meter: #cfaa65; }
.survival-actions { display: grid; grid-template-columns: 1.2fr 1fr; gap: 6px; padding: .25rem .83rem .83rem; }
.survival-actions .outline { padding-inline: .3rem; }
.job-list { display: grid; gap: 5px; padding: .55rem .55rem 0; }
.job { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem; text-align: start; padding: .34rem .45rem; color: var(--ink); border: 1px solid transparent; border-radius: 6px; background: var(--inset); transition: background .15s, border .15s, transform .15s; }
.job:not(:disabled):hover { border-color: #708268; background: #303e30; transform: translateY(-1px); }
.job:disabled { opacity: .58; }
.job .item-icon { width: 33px; height: 33px; padding: 4px; }
.job strong, .job small { display: block; }
.job strong { font-size: .85rem; }
.job small { color: var(--muted); font-size: .73rem; }
.job-end { color: var(--green); font-size: 1.05rem; }
.text-button { background: transparent; border: 0; border-radius: 3px; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; font-size: .76rem; margin: .54rem .72rem .75rem; padding: 4px; text-align: start; }
.text-button:hover { color: #fff0c8; }
.text-button:disabled { opacity: .5; }

.map-info, .tile-info { font-size: .76rem; color: var(--muted); }
.placing-hint { position: absolute; display: flex; align-items: center; justify-content: space-between; gap: .4rem; background: #182219f5; border: 1px solid #ad8b53; border-radius: 5px; padding: .36rem .45rem .36rem .7rem; font-size: .79rem; }
.tile-info { margin-left: auto; text-align: end; line-height: 1.1; }

.blueprints { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr)); gap: .48rem; padding: .58rem; }
.blueprint { min-height: 65px; display: grid; grid-template-columns: 40px minmax(0, 1fr); text-align: start; align-items: center; gap: .38rem; padding: .35rem; border-radius: 6px; border: 1px solid #40513e; background: #283629; transition: background .15s, border .15s, transform .15s; }
.blueprint:not(:disabled):hover, .blueprint[aria-pressed='true'] { background: #354533; border-color: #bfa269; transform: translateY(-1px); }
.blueprint:disabled { opacity: .64; }
.blueprint img, .blueprint canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.blueprint strong, .blueprint small { display: block; }
.blueprint strong { font-size: .8rem; line-height: 1.1; overflow-wrap: anywhere; }
.blueprint small { color: var(--muted); margin-top: 3px; font-size: .71rem; }
.blueprint small.short { color: #e3aa93; }

.quest-body { padding: .7rem .82rem .85rem; }
.quest-art { height: 72px; overflow: hidden; position: relative; border: 1px solid #4c5239; background: #363e2a; border-radius: 6px; margin-bottom: .65rem; }
.quest-art canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; object-fit: cover; }
.quest h3 { color: #f4d39a; font: 700 1.2rem/1.16 var(--display); }
.quest p { margin-top: .2rem; color: var(--muted); font-size: .79rem; }
.goal-list { display: grid; gap: .42rem; margin-block: .73rem; }
.goal-line { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: .5rem; color: #d9dfcf; font-size: .82rem; }
.goal-line .small-diamond { color: #7e8a70; width: 5px; height: 5px; }
.goal-line.finished .small-diamond, .goal-line.finished b { color: var(--green); }
.goal-line b { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .76rem; }
.goal-meter { height: 5px; }
.feed { list-style: none; padding: 0; margin: 0; max-height: 269px; overflow: auto; scrollbar-width: thin; }
.feed li { display: grid; grid-template-columns: 19px minmax(0, 1fr); align-items: start; gap: .5rem; padding: .59rem .79rem; font-size: .79rem; }
.feed li + li { border-top: 1px solid #324035; }
.feed span[data-icon] { height: 18px; }
.feed strong { display: block; font-size: .8rem; color: var(--ink); overflow-wrap: anywhere; }
.feed small, .empty-feed { color: var(--muted); }
.feed li.empty-feed { display: block; }

.notice { position: fixed; bottom: 1.15rem; left: 50%; z-index: 2; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1rem); background: #202e22; border: 1px solid #819769; color: #f6ebd1; padding: .65rem .95rem; border-radius: 7px; box-shadow: 0 8px 28px #0a0d09a0; font-size: .88rem; }
.notice.error { border-color: #c1917a; }
dialog { width: min(370px, calc(100% - 30px)); border: 1px solid #65745f; background: var(--panel); color: var(--ink); border-radius: 9px; padding: 1.15rem; }
dialog::backdrop { background: #0b110ccc; }
dialog h2 { font: 700 1.5rem/1.15 var(--display); margin-bottom: .75rem; }
dialog label { display: block; color: var(--muted); font-size: .88rem; }
dialog input { width: 100%; padding: .45rem .55rem; margin-top: .3rem; color: var(--ink); background: #152019; border: 1px solid #5a6e57; border-radius: 5px; }
.form-error { min-height: 1rem; margin-top: .35rem; color: #f0ab92; font-size: .78rem; }
.dialog-actions { display: flex; justify-content: end; gap: .55rem; margin-top: .65rem; }

@media (max-width: 1100px) {
  .shell { width: calc(100% - 36px); }
  .game-grid { gap: 10px; grid-template-columns: minmax(153px, .8fr) minmax(330px, 2.6fr) minmax(180px, .95fr); }
  .left-pane, .center-pane, .right-pane { gap: 10px; }
  .stock-item, .stock-title { padding-inline: .7rem; }
  .blueprints { grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr)); }
  .blueprint { grid-template-columns: 28px minmax(0, 1fr); }
  .blueprint canvas { width: 28px; height: 28px; }
}
@media (max-width: 860px) {
  .game-grid { grid-template-columns: minmax(160px, .75fr) minmax(320px, 2fr); }
  .right-pane { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 580px) {
  .shell { width: calc(100% - 24px); }
  .topbar-inner { min-height: 58px; }
  .brand { font-size: 1.17rem; gap: 5px; }
  .brand img { width: 31px; height: 31px; }
  .top-actions { gap: .34rem; }
  .online { gap: .28rem; font-size: .68rem; }
  .signal { width: 5px; height: 5px; }
  #share { font-size: .73rem; padding-inline: .43rem; }
  #profile-name { display: none; }
  .profile { padding: .35rem; }
  main { padding-top: 18px; }
  .world-heading { align-items: center; margin-bottom: 12px; }
  .eyebrow { font-size: .62rem; letter-spacing: .07em; }
  h1 { font-size: clamp(1.84rem, 8vw, 2.35rem); }
  .day { min-width: 0; padding: .33rem .4rem; gap: .25rem; }
  .day [data-icon] { width: 21px; height: 21px; }
  .day strong { font-size: .72rem; }
  .day small { font-size: .65rem; }
  .stockbar { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 11px; padding: 0; }
  .stock-title { grid-column: 1 / -1; min-height: 0; padding: .3rem .58rem; font-size: .8rem; flex-direction: row; align-items: baseline; justify-content: start; gap: .5rem; border-bottom: 1px solid var(--line); }
  .stock-title + .stock-item { border-left: 0; }
  .stock-item { min-height: 49px; padding: .23rem .25rem; gap: .24rem; }
  .stock-item small { font-size: .62rem; line-height: 1.05; }
  .stock-item strong { font-size: 1.08rem; }
  .stock-item .item-icon { width: 26px; height: 26px; padding: 3px; }
  .game-grid { grid-template-columns: 1fr; }
  .center-pane { grid-row: 1; }
  .left-pane { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .right-pane { grid-template-columns: 1fr; }
  .panel-heading { min-height: 39px; padding-inline: .6rem; }
  .panel-heading h2 { font-size: 1.05rem; }
  .vitals { padding-inline: .6rem; }
  .survival-actions { grid-template-columns: 1fr; padding-inline: .6rem; }
  .job-list { padding-inline: .34rem; }
  .job { gap: .34rem; padding-inline: .27rem; }
  .job .item-icon { width: 27px; height: 27px; }
  .job strong { font-size: .76rem; }
  .blueprint { grid-template-columns: 1fr; grid-template-rows: 23px auto; gap: .13rem; justify-items: center; text-align: center; padding-inline: .26rem; }
  .blueprint canvas { width: 25px; height: 25px; }
  .quest-art { height: 94px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
