* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Verdana, Arial, sans-serif;
  background: #120c0a;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}
#scene-container { position: fixed; inset: 0; touch-action: none; }
#scene-container canvas { display: block; touch-action: none; }
.hidden { display: none !important; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; }

#loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4em; color: #ffc629; background: #120c0a;
}

#title, #summary {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40, 15, 8, 0.2), rgba(20, 8, 4, 0.75));
  padding: 16px;
  overflow-y: auto;
}
.card {
  max-width: 620px;
  background: rgba(62, 25, 19, 0.93);
  border: 4px solid #ffc629;
  border-radius: 18px;
  padding: 22px 28px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
#title h1 { margin: 0 0 8px; color: #ffc629; font-size: 2.4em; text-shadow: 0 3px 0 #a5482f; }
.tag { margin: 0 0 18px; line-height: 1.45; }
.buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
button.big {
  font-size: 1.2em; font-weight: bold;
  padding: 14px 22px; border: none; border-radius: 12px;
  background: #ffc629; color: #3e1913; cursor: pointer;
  box-shadow: 0 4px 0 #a5822a;
}
button.big.alt { background: #f2efe6; box-shadow: 0 4px 0 #9c968a; }
button.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #a5822a; }
button.link { background: none; border: none; color: #e8b8a8; text-decoration: underline; cursor: pointer; margin-top: 6px; }
.note { font-size: 0.9em; opacity: 0.85; margin: 10px 0 0; min-height: 1em; }
details { margin-top: 12px; text-align: left; }
summary { cursor: pointer; font-weight: bold; color: #ffc629; }
details ul { padding-left: 20px; line-height: 1.45; font-size: 0.9em; }

#summary h2 { color: #ffc629; margin: 0 0 6px; }
#summary-stars { font-size: 2.2em; color: #ffc629; letter-spacing: 4px; }
#summary-body p { margin: 8px 0; line-height: 1.35; }
#summary-next { margin-top: 12px; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#topbar {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 10, 5, 0.72); padding: 6px 16px; border-radius: 10px;
  text-align: center; font-size: 0.95em;
}
#money { color: #ffc629; font-weight: bold; font-size: 0.9em; }
#orders { position: absolute; top: 10px; left: 10px; width: 240px; }
.ord {
  background: rgba(251, 248, 239, 0.94); color: #111;
  border-left: 6px solid #2e7d32; border-radius: 6px;
  padding: 5px 8px; margin-bottom: 6px; font-size: 0.82em; position: relative;
  font-family: 'Courier New', monospace;
}
.ord span { position: absolute; top: 5px; right: 8px; font-weight: bold; }
.ord.warn { border-left-color: #e0a020; }
.ord.late { border-left-color: #c62828; }
.ord.reg { background: #ffc629; border-left-color: #9e2f26; font-weight: bold; font-family: inherit; }
#stock {
  position: absolute; bottom: 52px; left: 10px; font-size: 0.78em;
  background: rgba(20, 10, 5, 0.6); padding: 4px 8px; border-radius: 6px;
}
#crosshair {
  position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}
#aim { position: absolute; top: calc(50% + 16px); left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
#aim-label { font-weight: bold; font-size: 1.0em; }
#aim-action { font-size: 0.85em; color: #ffe08a; }
#aim-action.bad { color: #ff9a8a; }
#held {
  position: absolute; bottom: 52px; right: 12px; font-weight: bold;
  text-shadow: 0 1px 3px #000; font-size: 0.95em;
}
#toast {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  max-width: min(640px, 92vw); padding: 10px 16px; border-radius: 10px;
  background: rgba(25, 15, 10, 0.88); font-weight: bold; text-align: center;
  opacity: 0; transition: opacity 0.2s;
}
#toast.show { opacity: 1; }
#toast.good { background: rgba(20, 90, 40, 0.92); }
#toast.bad { background: rgba(130, 25, 20, 0.92); }
#toast.tip { background: rgba(30, 45, 95, 0.94); }
#subtitle {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65); color: #ffe08a; font-weight: bold; font-size: 1.4em;
  padding: 10px 20px; border-radius: 12px; max-width: 80vw; text-align: center;
}
#click-to-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(255, 198, 41, 0.95); color: #3e1913; font-weight: bold;
  padding: 12px 20px; border-radius: 12px; font-size: 1.1em;
}
#hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 10, 5, 0.7); padding: 6px 14px; border-radius: 10px;
  font-size: 0.85em; text-align: center; max-width: 92vw;
}
#btn-mute {
  position: absolute; top: 10px; right: 10px; pointer-events: auto;
  font-size: 1.4em; background: rgba(20, 10, 5, 0.7); border: none; border-radius: 10px;
  padding: 6px 10px; cursor: pointer;
}

#btn-recipes {
  position: absolute; top: 56px; right: 10px; pointer-events: auto;
  font-size: 0.85em; font-weight: bold; background: rgba(255, 198, 41, 0.92); color: #3e1913;
  border: none; border-radius: 10px; padding: 6px 10px; cursor: pointer;
}
#training {
  position: absolute; top: 100px; right: 10px; width: min(340px, 44vw); pointer-events: auto;
  background: rgba(30, 45, 95, 0.95); border: 3px solid #9fd3f5; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
#training-step { color: #9fd3f5; font-weight: bold; font-size: 0.85em; margin-bottom: 4px; }
#training-text { font-size: 0.95em; line-height: 1.35; }
#training-skip { margin-top: 8px; background: none; border: none; color: #c8d8ff; text-decoration: underline; cursor: pointer; padding: 0; }
#recipes {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 5, 2, 0.6); padding: 16px; overflow-y: auto;
}
#recipes h2 { color: #ffc629; margin: 0 0 6px; }
.recipes table { width: 100%; border-collapse: collapse; text-align: left; margin: 8px 0; font-size: 0.92em; }
.recipes td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.15); vertical-align: top; }
.recipes .short { opacity: 0.6; font-size: 0.8em; }

#btn-phone {
  position: absolute; top: 100px; right: 10px; pointer-events: auto;
  font-size: 0.85em; font-weight: bold; background: rgba(240, 240, 240, 0.92); color: #222;
  border: none; border-radius: 10px; padding: 6px 10px; cursor: pointer;
}
#training { top: 144px; }
#phone {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding: 16px 40px; background: rgba(0, 0, 0, 0.25);
}
#phone .ph-body {
  width: min(360px, 92vw); height: min(640px, 92vh); display: flex; flex-direction: column;
  background: #101014; border: 10px solid #222; border-radius: 34px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden; color: #eee;
}
.ph-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; font-weight: bold; color: #ffc629; }
#phone-money { color: #7dff9a; }
#phone-close { background: none; border: none; color: #aaa; font-size: 1.2em; cursor: pointer; }
.ph-tabs { display: flex; gap: 6px; padding: 4px 12px 8px; }
.ph-tab { flex: 1; padding: 8px; border: none; border-radius: 12px; background: #23232b; color: #ccc; font-weight: bold; cursor: pointer; }
.ph-tab.on { background: #ffc629; color: #3e1913; }
#phone-list { flex: 1; overflow-y: auto; padding: 0 10px; }
.ph-row { display: flex; align-items: center; gap: 10px; background: #1b1b22; border-radius: 14px; padding: 10px; margin-bottom: 8px; }
.ph-row.done { opacity: 0.6; }
.ph-ic { font-size: 1.8em; }
.ph-tx { flex: 1; display: flex; flex-direction: column; font-size: 0.85em; }
.ph-tx span { color: #aab; }
.ph-tx i { color: #7dff9a; font-style: normal; font-size: 0.9em; margin-top: 2px; }
.ph-row button { min-width: 64px; padding: 8px 10px; border: none; border-radius: 10px; background: #ffc629; color: #3e1913; font-weight: bold; cursor: pointer; }
.ph-row button:disabled { background: #444; color: #999; cursor: default; }
.ph-foot { padding: 8px 14px 14px; font-size: 0.75em; color: #889; text-align: center; }

#challenges { position: absolute; bottom: 82px; left: 10px; width: 250px; }
.chal-h { font-size: 0.75em; font-weight: bold; color: #ffc629; text-shadow: 0 1px 2px #000; margin-bottom: 3px; }
.chal { background: rgba(20, 10, 5, 0.75); border-left: 4px solid #ffc629; border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 0.78em; position: relative; }
.chal b { color: #7dff9a; }
.chal span { position: absolute; right: 8px; top: 4px; }
.chal.done { border-left-color: #2ecc71; opacity: 0.8; }
.chal.failed { border-left-color: #c62828; opacity: 0.6; }
.ord em { font-style: normal; font-size: 0.85em; background: #ffc629; color: #3e1913; border-radius: 4px; padding: 0 4px; }
