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

:root {
  color-scheme: dark;
  --bg: #101f1d;
  --panel: #19312c;
  --panel-2: #213c35;
  --line: rgba(235, 222, 185, .14);
  --cream: #f2e8cf;
  --muted: #aebcaf;
  --gold: #e9bd69;
  --green: #86b99a;
  --deep: #132923;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -20%, #2c5144 0, #172d28 42%, #0e1b19 100%);
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  padding: 24px 16px 30px;
}
button { font: inherit; }
.app-shell { width: min(100%, 1260px); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px;
  color: #1b352c; background: linear-gradient(145deg, #f4d18c, #c79550); font-size: 23px;
  box-shadow: 0 5px 18px rgba(0,0,0,.24);
}
.brand-name { font: 800 18px 'Manrope', sans-serif; letter-spacing: .18em; }
.brand-subtitle { font-size: 9px; letter-spacing: .18em; color: #b3c2b5; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 12px; color: var(--cream); background: #1a332d; cursor: pointer; }
.icon-button:hover, .small-button:hover { background: #29483c; border-color: rgba(233,189,105,.5); }
.statusbar { display: grid; grid-template-columns: 1fr 1.55fr .8fr; gap: 10px; margin-bottom: 12px; }
.status-card { min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 10px 15px; background: linear-gradient(135deg, rgba(35,64,54,.96), rgba(24,47,41,.96)); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.status-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 11px; color: #f3d18e; background: rgba(233,189,105,.13); font-size: 19px; }
.status-label { display: block; color: #a9b9ab; font-size: 9px; letter-spacing: .13em; margin-bottom: 4px; }
.status-card strong { display: block; font: 700 14px 'Manrope', sans-serif; color: #fff2d6; }
.coin-icon { color: #e9bd69; font-size: 24px; width: 28px; text-align: center; }
.game-frame { padding: 10px; overflow: hidden; background: linear-gradient(145deg, #29473d, #172e28); border: 1px solid rgba(233, 218, 177, .2); border-radius: 19px; box-shadow: 0 22px 60px rgba(0,0,0,.32); }
.canvas-wrap { position: relative; overflow: hidden; border-radius: 11px; background: #c9a56c; line-height: 0; }
#game { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; image-rendering: pixelated; image-rendering: crisp-edges; background: #cba66d; touch-action: none; }
.location-pill { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(20,39,32,.82); color: #f5e8cb; font-size: 10px; line-height: 1; backdrop-filter: blur(5px); }
.location-dot { width: 6px; height: 6px; border-radius: 50%; background: #a6d49d; box-shadow: 0 0 8px #a6d49d; }
.minimap-frame { position: absolute; top: 12px; right: 12px; width: 154px; padding: 4px; border: 1px solid rgba(255,255,255,.2); border-radius: 9px; background: rgba(20,39,32,.84); line-height: 0; }
#minimap { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.interaction-hint { position: absolute; left: 50%; bottom: 13px; transform: translateX(-50%); display: none; padding: 8px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: rgba(18,35,29,.9); color: #f8edda; font-size: 11px; line-height: 1; white-space: nowrap; }
.interaction-hint.visible { display: block; }
kbd, .tip-key { padding: 2px 5px; border-radius: 4px; background: rgba(240,225,191,.15); color: #f1d28f; font: 700 10px 'Manrope', sans-serif; }
.toast { position: absolute; top: 58px; left: 50%; transform: translate(-50%, -8px); max-width: calc(100% - 30px); padding: 9px 13px; border: 1px solid rgba(243,213,153,.25); border-radius: 8px; background: rgba(20,39,32,.94); color: #f6e5bd; font-size: 11px; line-height: 1.35; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.game-footer { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 4px 0; color: #b8c6b7; font-size: 10px; }
.footer-tip { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tip-separator { color: #697f70; margin: 0 3px; }
.footer-actions { display: flex; gap: 7px; }
.small-button { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #1c382f; color: #e8e3d1; font-size: 10px; cursor: pointer; }
#itemCount { display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 3px; border-radius: 50%; background: #b18a4f; color: #172b24; font-weight: 800; }
.mobile-controls { display: none; align-items: center; justify-content: space-between; padding: 15px 5px 0; }
.dpad { position: relative; width: 126px; height: 112px; }
.dpad-button { position: absolute; width: 39px; height: 35px; border: 1px solid rgba(235,222,185,.22); border-radius: 9px; background: #244238; color: #f3dbab; touch-action: none; user-select: none; }
.dpad-button:active { background: #496a52; }
.dpad-button.up { left: 43px; top: 0; }.dpad-button.down { left: 43px; bottom: 0; }.dpad-button.left { left: 0; top: 38px; }.dpad-button.right { right: 0; top: 38px; }
.interact-button { min-width: 116px; height: 45px; border: 1px solid rgba(236,203,137,.35); border-radius: 13px; background: #b4874f; color: #172c24; font-size: 10px; font-weight: 800; letter-spacing: .08em; touch-action: manipulation; }
.interact-button span { margin-right: 5px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 4px 0; color: #82988a; font-size: 9px; letter-spacing: .05em; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(5,14,12,.72); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.game-modal { width: min(100%, 440px); max-height: min(80vh, 620px); overflow: auto; padding: 21px; border: 1px solid rgba(233,189,105,.3); border-radius: 18px; background: linear-gradient(145deg, #27483c, #152f28); box-shadow: 0 25px 80px rgba(0,0,0,.45); }
.modal-topline { display: flex; align-items: center; justify-content: space-between; }
.modal-eyebrow { color: #dbb979; font-size: 9px; letter-spacing: .19em; font-weight: 800; }
.modal-close { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 9px; background: #1b382f; color: #f5e8ce; font-size: 20px; line-height: 1; cursor: pointer; }
.game-modal h2 { margin: 13px 0 10px; font: 800 21px 'Manrope', sans-serif; color: #fff0d2; }
.modal-content { color: #c5d0c2; font-size: 13px; line-height: 1.65; }
.modal-content p { margin: 0 0 10px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.modal-action { border: 1px solid rgba(233,189,105,.32); border-radius: 9px; padding: 9px 13px; background: #bb9258; color: #172d25; font-size: 11px; font-weight: 800; cursor: pointer; }
.modal-action.secondary { background: #1d3a30; color: #eadfc8; border-color: var(--line); }
.shop-row, .inventory-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid rgba(235,222,185,.1); }
.shop-row:first-child, .inventory-row:first-child { border-top: 0; }
.shop-item-name { color: #f4e7ca; font-weight: 700; }
.shop-item-desc { display: block; color: #9eb2a1; font-size: 10px; }
.shop-buy { border: 1px solid rgba(233,189,105,.3); border-radius: 7px; padding: 6px 9px; background: #b98c52; color: #172d25; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.shop-buy:disabled { opacity: .4; cursor: not-allowed; }
.empty-note { padding: 12px; border: 1px dashed rgba(235,222,185,.2); border-radius: 9px; color: #9fb0a1; text-align: center; }

@media (max-width: 620px) {
  body { padding: 14px 9px 22px; }
  .topbar { margin-bottom: 12px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .brand-name { font-size: 15px; }
  .brand-subtitle { font-size: 8px; }
  .statusbar { grid-template-columns: 1fr 1fr; gap: 7px; }
  .status-card { min-height: 58px; padding: 8px 10px; gap: 8px; border-radius: 12px; }
  .status-icon { width: 29px; height: 29px; flex-basis: 29px; font-size: 16px; }
  .status-label { font-size: 8px; }
  .status-card strong { font-size: 12px; }
  .coin-card { grid-column: 1 / -1; min-height: 42px; }
  .game-frame { padding: 6px; border-radius: 14px; }
  .minimap-frame { width: 98px; top: 8px; right: 8px; padding: 3px; }
  .location-pill { top: 8px; left: 8px; font-size: 9px; padding: 6px 8px; }
  .interaction-hint { bottom: 7px; font-size: 9px; }
  .game-footer { align-items: flex-start; flex-direction: column; padding: 9px 3px 3px; }
  .mobile-controls { display: flex; }
  .page-footer { font-size: 8px; }
}
@media (max-width: 390px) {
  .status-card { padding: 7px; }
  .status-card strong { font-size: 11px; }
  .footer-tip { font-size: 9px; }
  .page-footer span:last-child { text-align: right; }
}

/* JEJAK NUR v0.2: larger world view and clean pixel scaling */
.canvas-wrap { box-shadow: inset 0 0 0 1px rgba(255,245,218,.12); }
#game, #minimap { image-rendering: pixelated; image-rendering: crisp-edges; }
@media (min-width: 900px) { .game-frame { padding: 12px; } .minimap-frame { width: 166px; } }
@media (max-width: 620px) { .minimap-frame { width: 88px; } }

/* v0.3 — chibi sprites are drawn as nearest-neighbour pixel art. */
#game { image-rendering: pixelated; image-rendering: crisp-edges; }


/* JEJAK NUR v0.4 — warm oasis UI and an always-visible quest guide. */
:root {
  --bg: #17251f;
  --panel: #23382e;
  --panel-2: #2b4638;
  --cream: #fff0d0;
  --muted: #c2c7a9;
  --gold: #f0c56f;
  --green: #9fc78d;
}
body {
  background:
    radial-gradient(ellipse at 50% -18%, rgba(105,137,91,.35), transparent 48%),
    linear-gradient(145deg, #1b2c25 0%, #14211c 62%, #101b17 100%);
}
.game-frame {
  background: linear-gradient(145deg, #3e5b43, #243a30 58%, #1b3028);
  border-color: rgba(247,220,165,.28);
  box-shadow: 0 24px 65px rgba(0,0,0,.38), inset 0 1px rgba(255,255,255,.06);
}
.canvas-wrap { background: #d8b77b; }
.quest-panel {
  position: absolute;
  z-index: 2;
  left: 12px;
  top: 54px;
  width: min(250px, calc(100% - 190px));
  min-width: 170px;
  padding: 10px 12px 9px;
  border: 1px solid rgba(247,218,157,.48);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(48,61,43,.94), rgba(29,47,36,.94));
  color: #fff1d2;
  box-shadow: 0 7px 20px rgba(33,32,20,.25);
  line-height: 1.35;
  backdrop-filter: blur(5px);
}
.quest-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: #f4cb78;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
}
.quest-kicker span { font-size: 12px; }
.quest-panel strong { display: block; color: #fff0d0; font: 800 11px 'Manrope',sans-serif; }
.quest-panel p { margin: 4px 0 6px; color: #e2dfc8; font-size: 9px; line-height: 1.45; }
.quest-panel small { display: inline-block; padding: 3px 6px; border-radius: 5px; background: rgba(238,194,104,.15); color: #f4d68d; font-size: 8px; font-weight: 700; }
.location-pill { background: rgba(34,50,37,.91); border-color: rgba(251,224,173,.34); }
.minimap-frame { border-color: rgba(251,224,173,.44); box-shadow: 0 6px 16px rgba(24,29,21,.22); }
.interaction-hint { background: rgba(38,55,39,.96); border-color: rgba(245,210,140,.45); box-shadow: 0 4px 12px rgba(0,0,0,.24); }
.toast { background: rgba(41,58,43,.97); border-color: rgba(245,210,140,.42); box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.status-card { background: linear-gradient(140deg, rgba(48,75,56,.97), rgba(32,53,41,.97)); border-color: rgba(239,218,169,.2); }
.icon-button, .small-button { background: #2c4938; }
.game-modal { background: linear-gradient(145deg, #35543f, #1d362b); }
.modal-action { background: linear-gradient(145deg, #edc77e, #c99752); }
@media (max-width: 620px) {
  .quest-panel { top: 52px; left: 8px; width: 175px; min-width: 0; padding: 7px 8px; }
  .quest-panel strong { font-size: 9px; }
  .quest-panel p { font-size: 8px; }
  .quest-panel small { font-size: 7px; }
}


/* JEJAK NUR v0.5 — softer chibi scale and improved quest panel. */
.quest-panel { border-color: rgba(246,220,161,.58); box-shadow: 0 8px 22px rgba(34,35,21,.32), inset 0 1px rgba(255,255,255,.08); }
#game { background: #d8b77b; }


/* JEJAK NUR v0.6 — refined small character scale and stable frame presentation. */
#game { image-rendering: pixelated; }


/* JEJAK NUR v0.7 — open-ended sandbox controls and building journal. */
.quest-panel { transition: border-color .2s, background .2s; }
.quest-panel:has(.quest-step-free) { border-color: rgba(157,210,145,.55); }
.footer-actions { flex-wrap: wrap; justify-content: flex-end; }
.small-button kbd { margin-left: 3px; font-size: 8px; opacity: .8; }
.shop-section-title { margin: 15px 0 6px; color: #f2d08c; font: 800 11px 'Manrope',sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.sell-button { background: linear-gradient(145deg,#83a981,#557e65); color: #fff7dd; }
.sandbox-note { margin-top: 12px; padding: 9px 11px; border-radius: 9px; background: rgba(147,190,133,.12); border: 1px solid rgba(168,206,143,.22); color: #dcebd1; font-size: 11px; }
.journal-complete { display: inline-block; margin-top: 6px; color: #a8d69b; font-weight: 700; }
.sandbox-activities { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.sandbox-activities > div { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 9px; background: rgba(238,218,172,.08); border: 1px solid rgba(238,218,172,.13); }
.sandbox-activities b { color: #f2d18d; font-size: 11px; }
.sandbox-activities span { color: #d4ddc8; font-size: 10px; line-height: 1.4; }
@media (max-width: 620px) {
  .footer-actions { justify-content: flex-start; }
  .small-button { padding: 7px 8px; font-size: 9px; }
  .sandbox-activities { grid-template-columns: 1fr; }
}

.small-button#removeButton { border-color: rgba(226,145,122,.35); color: #f2c8b4; }
