:root {
  --card: #fffdf8;
  --ink: #2f2a22;
  --muted: #7a7064;
  --line: #e4d9c4;
  --brand: #e8692b;
  --brand-dark: #b8501f;
  --good: #2e8b3d;
  --bad: #c0392b;
  --gold: #f2b705;
  --blue: #2f6fd8;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  background: #222;
  color: var(--ink);
  user-select: none;
}
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  margin-right: 4px;
  border-radius: 6px;
  background: #fff;
  color: #2f2a22;
  font: bold 15px "Trebuchet MS", sans-serif;
  text-align: center;
  box-shadow: 0 2px 0 #b3a994;
}

/* --- Oven på spillet --- */
#topbar {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(40, 30, 20, 0.8);
  color: #fff;
  pointer-events: none;
}
.brand { font-size: 17px; font-weight: bold; }
.stat { font-size: 18px; }
.stat b { font-size: 20px; }
.money b { color: #ffe066; }
.daybar { width: 80px; height: 5px; background: rgba(255, 255, 255, 0.25); border-radius: 3px; margin-top: 3px; overflow: hidden; }
.daybar div { height: 100%; background: #ffe066; }

#goal {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 5;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 248, 220, 0.93);
  border: 3px solid var(--gold);
  pointer-events: none;
}
.goal-title { font-weight: bold; font-size: 18px; }
#goal .tip { color: var(--muted); font-size: 15px; margin-top: 4px; }
#goal .reward { font-weight: bold; color: var(--good); font-size: 14px; margin-top: 4px; }
#goal .effects { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #d9c79a; font-size: 14px; }

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 3px #000;
  z-index: 4;
  pointer-events: none;
}
#prompt {
  position: fixed;
  left: 50%;
  top: calc(50% + 40px);
  transform: translateX(-50%);
  z-index: 5;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(40, 30, 20, 0.85);
  color: #fff;
  font-size: 18px;
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}
#prompt .p-title { font-weight: bold; color: #ffe066; }
#prompt .muted { color: #e0d2bf; }
#carry {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 5;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(40, 30, 20, 0.8);
  color: #fff;
  pointer-events: none;
}
#carry .muted { color: #c9bba8; }

/* --- Knapper --- */
button {
  font: inherit;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--brand-dark);
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }
button:disabled { background: #cfc6b6; box-shadow: 0 3px 0 #b3a994; cursor: default; }
button.small { font-size: 14px; padding: 5px 10px; }
button.huge { font-size: 26px; padding: 14px 40px; }
button.blue { background: var(--blue); box-shadow: 0 3px 0 #1f4fa0; }
button.green { background: var(--good); box-shadow: 0 3px 0 #1f6a2c; }
button.grey { background: #8a7f70; box-shadow: 0 3px 0 #6a604f; }
select { font: inherit; font-size: 15px; padding: 5px 8px; border-radius: 10px; border: 2px solid var(--line); background: #fff; max-width: 100%; }

/* --- Start og pause --- */
#screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px;
  background: rgba(30, 20, 10, 0.55);
}
#screen-box {
  margin: auto;
  max-width: 620px;
  padding: 26px 32px;
  border-radius: 24px;
  border: 5px solid var(--brand);
  background: var(--card);
  text-align: center;
}
#screen-box h1 { margin: 0 0 6px; font-size: 34px; }
.big-text { font-size: 22px; font-weight: bold; }
.row.center { justify-content: center; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; text-align: left; margin: 18px 0; padding: 14px; border-radius: 14px; background: #f4efe4; }

/* --- Menuerne --- */
#menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(30, 20, 10, 0.45);
}
.menu-box {
  width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 4px solid var(--brand);
  background: #f4efe4;
  overflow: hidden;
}
#menu-head { padding: 14px 18px 0; background: #fffaf0; border-bottom: 2px solid var(--line); }
.menu-top { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.menu-top h1 { margin: 0; font-size: 26px; margin-right: auto; }
.menu-money { font-size: 20px; font-weight: bold; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tabs button { background: #e9dfcc; color: var(--ink); box-shadow: 0 3px 0 #c9b998; }
.tabs button.active { background: var(--brand); color: #fff; box-shadow: 0 3px 0 var(--brand-dark); }
#menu-body { padding: 16px 18px; overflow-y: auto; }
#menu-body h2 { margin: 16px 0 10px; font-size: 22px; }
#menu-body h2 small { font-size: 15px; color: var(--muted); font-weight: normal; }

.card { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.card h3 { margin: 0 0 8px; font-size: 19px; }
.log { font-size: 14px; }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log small { color: var(--muted); }
.intro { color: var(--muted); margin: 0 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.big { font-size: 40px; line-height: 1; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.locked { opacity: 0.6; }
.done { opacity: 0.75; background: #eef7ee; }
.recipe { font-size: 16px; color: var(--muted); }

.bar { height: 14px; background: #ece3d2; border-radius: 8px; overflow: hidden; margin: 8px 0; }
.bar div { height: 100%; background: var(--good); }
.bar.gold div { background: var(--gold); }
.bar.blue div { background: var(--blue); }
.bar.red div { background: var(--bad); }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 16px; overflow: hidden; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #efe5d2; font-size: 15px; }
td.emoji { font-size: 28px; width: 46px; }
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark span { width: 5px; background: #c9b998; border-radius: 2px; }
.spark span:last-child { background: var(--brand); }

/* --- Beskeder --- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 25; max-width: 380px; pointer-events: none; }
.toast {
  background: rgba(40, 30, 20, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  animation: slide 0.25s ease-out;
  font-size: 15px;
}
.toast.good { background: #2e7a3a; }
.toast.bad { background: #a8322a; }
.toast.goal { background: #b8860b; font-size: 17px; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

.float-money {
  position: fixed;
  color: #ffe066;
  font-weight: bold;
  font-size: 22px;
  pointer-events: none;
  z-index: 15;
  transform: translateX(-50%);
  animation: rise 1.3s ease-out forwards;
  text-shadow: 0 1px 3px #000;
}
@keyframes rise { to { transform: translate(-50%, -50px); opacity: 0; } }

.confetti {
  position: fixed;
  top: -40px;
  font-size: 28px;
  pointer-events: none;
  z-index: 40;
  animation: fall 1.8s ease-in forwards;
}
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

/* --- Valg ved begivenheder --- */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 10, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 50;
  overflow-y: auto;
  padding: 16px;
}
#modal .dialog {
  margin: auto;
  background: var(--card);
  border: 4px solid var(--brand);
  border-radius: 22px;
  padding: 24px 28px;
  max-width: 560px;
  text-align: center;
}
#modal h2 { margin-top: 0; font-size: 28px; }
#modal p { font-size: 18px; line-height: 1.45; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; align-items: center; }

@media (max-width: 900px) {
  #goal { max-width: 240px; font-size: 14px; }
  #topbar { gap: 10px; font-size: 14px; }
}
