:root {
  --ink: #f7f2df;
  --muted: #c9c0a6;
  --panel: rgba(25, 28, 29, 0.78);
  --panel-strong: rgba(19, 21, 22, 0.92);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #f3c35d;
  --accent-2: #70c2a8;
  --good: #72ca78;
  --warn: #f1b95b;
  --bad: #e86b67;
  --shadow: rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #1c251d;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 18px;
  background: #f0c45f;
  color: #251d12;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px var(--shadow);
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
  opacity: 0.45;
  filter: grayscale(0.3);
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

button.danger {
  border-color: rgba(232, 107, 103, 0.4);
  color: #ffd2cf;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.panel {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 36px var(--shadow);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.needs-panel {
  left: 16px;
  top: 16px;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
}

.needs-title,
.quest-panel #questTitle {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 13px;
}

.need-row {
  display: grid;
  grid-template-columns: 74px 1fr 34px;
  align-items: center;
  gap: 9px;
  min-height: 24px;
  font-size: 13px;
}

.need-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.need-fill {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
}

.need-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-panel {
  left: 16px;
  bottom: 16px;
  width: min(250px, calc(100vw - 32px));
  padding: 12px 14px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 26px;
  font-size: 13px;
}

.status-line span {
  color: var(--muted);
}

.status-line strong {
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.quest-panel {
  top: 16px;
  left: 50%;
  width: min(520px, calc(100vw - 360px));
  min-width: 260px;
  transform: translateX(-50%);
  padding: 13px 16px;
  text-align: center;
}

.quest-panel p {
  margin: 0;
  color: #fff7df;
  font-size: 14px;
  line-height: 1.35;
}

.minimap-panel {
  right: 16px;
  top: 16px;
  width: 234px;
  height: 174px;
  padding: 11px;
}

#minimap {
  width: 210px;
  height: 150px;
  display: block;
  border-radius: 6px;
  background: #2d4d35;
}

.prompt-panel {
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: calc(100vw - 40px);
  padding: 12px 18px;
  text-align: center;
  opacity: 0;
  translate: 0 12px;
  transition: opacity 140ms ease, translate 140ms ease;
}

.prompt-panel.show {
  opacity: 1;
  translate: 0 0;
}

.toast-panel {
  right: 16px;
  bottom: 16px;
  width: min(340px, calc(100vw - 32px));
  min-height: 46px;
  padding: 12px 15px;
  opacity: 0;
  translate: 0 12px;
  transition: opacity 160ms ease, translate 160ms ease;
}

.toast-panel.show {
  opacity: 1;
  translate: 0 0;
}

.context-menu {
  min-width: 190px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 10px;
  display: grid;
  gap: 8px;
  z-index: 20;
}

.context-menu[hidden] {
  display: none;
}

.context-title {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.context-actions {
  display: grid;
  gap: 7px;
}

.context-actions button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  text-align: left;
  box-shadow: none;
}

.action-panel {
  left: 50%;
  bottom: 82px;
  width: min(380px, calc(100vw - 36px));
  padding: 12px 14px;
  transform: translateX(-50%);
  opacity: 0;
  translate: 0 10px;
  transition: opacity 160ms ease, translate 160ms ease;
}

.action-panel.show {
  opacity: 1;
  translate: 0 0;
}

#actionName {
  margin-bottom: 8px;
  font-weight: 800;
  text-align: center;
}

#actionTrack {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

#actionFill {
  width: 0;
  height: 100%;
  background: var(--accent-2);
}

.round-button {
  position: absolute;
  right: 16px;
  top: 204px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  pointer-events: auto;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 22px;
  overflow: hidden;
  background: rgba(12, 14, 14, 0.48);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.screen.active {
  display: grid;
}

.menu {
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100dvh - 44px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  padding: clamp(22px, 4vw, 34px);
  cursor: default;
}

.title-menu {
  width: min(660px, calc(100vw - 36px));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(46px, 8vw, 84px);
}

h2 {
  font-size: clamp(30px, 5vw, 48px);
}

.tagline,
.summary {
  margin: 18px 0 0;
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.5;
}

.version-note {
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.settings-menu {
  width: min(600px, calc(100vw - 36px));
}

.inventory-menu {
  width: min(560px, calc(100vw - 36px));
}

.fridge-menu,
.box-menu {
  width: min(680px, calc(100vw - 36px));
}

.shop-menu,
.phone-menu,
.furniture-menu,
.car-shop-menu,
.work-menu,
.wardrobe-menu,
.clothes-menu,
.restaurant-menu {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.inventory-details,
.storage-column-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.storage-column {
  min-width: 0;
}

.storage-title {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inventory-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.item-line {
  flex-wrap: wrap;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
}

.inventory-actions button {
  min-height: 36px;
  padding: 0 12px;
}

.inventory-line span {
  color: var(--muted);
}

.inventory-line strong {
  text-align: right;
}

.shop-items {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.shop-category {
  margin-top: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.shop-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.25;
}

.shop-price {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.phone-menu {
  background: linear-gradient(180deg, color-mix(in srgb, var(--phone-wallpaper, #1f2937) 58%, #111 42%), rgba(15, 17, 18, 0.96));
}

.phone-app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.phone-app {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 128px;
  padding: 12px 10px;
  text-align: center;
}

.phone-app small {
  color: var(--muted);
  line-height: 1.2;
}

.phone-app-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  color: #fff;
  font-weight: 900;
}

.phone-app-icon-delivery {
  position: relative;
  background: #2877d9;
  color: transparent;
}

.phone-app-icon-delivery::before {
  content: "";
  width: 26px;
  height: 16px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 15px 5px 0 -6px #fff;
}

.phone-app-icon-music {
  background: #8b4bd8;
  font-size: 27px;
}

.phone-app-icon-settings {
  background: #46525d;
  font-size: 22px;
}

.phone-wallpapers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.phone-wallpaper {
  width: 64px;
  min-width: 64px;
  height: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.color-swatch {
  width: 38px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.slider-row,
.toggle-row {
  display: grid;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--ink);
}

.slider-row {
  grid-template-columns: 92px 1fr 54px auto;
}

.audio-mute {
  min-width: 76px;
  min-height: 34px;
  padding: 0 10px;
}

.audio-mute.active {
  border-color: rgba(216, 191, 106, 0.65);
  color: #f3db8f;
  background: rgba(216, 191, 106, 0.14);
}

.toggle-row {
  grid-template-columns: 1fr auto;
}

.cheat-toggle {
  width: 100%;
  margin-top: 18px;
}

.cheats-panel {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.cheats-panel[hidden] {
  display: none;
}

.slider-row span,
.toggle-row span {
  color: var(--muted);
  font-weight: 700;
}

.slider-row output {
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-2);
}

.touch-controls {
  display: none;
}

body.mobile-player.touch-active .touch-controls {
  display: block;
}

.touch-joystick {
  --joy-x: 96px;
  --joy-y: calc(100% - 96px);
  --stick-x: 96px;
  --stick-y: calc(100% - 96px);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  width: 100vw;
  height: min(42vh, 330px);
  min-height: 190px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
}

.touch-joystick::before {
  content: "";
  position: absolute;
  left: var(--joy-x);
  top: var(--joy-y);
  width: 174px;
  height: 174px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(15, 17, 18, 0.38);
  box-shadow: 0 16px 34px var(--shadow);
  opacity: 0.42;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.touch-joystick.active::before {
  opacity: 0.82;
}

.touch-stick {
  position: absolute;
  left: var(--stick-x);
  top: var(--stick-y);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(240, 196, 95, 0.95);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 10px 24px rgba(0, 0, 0, 0.28);
}

.touch-joystick.active .touch-stick {
  opacity: 1;
}

.touch-actions {
  position: fixed;
  right: 18px;
  bottom: 28px;
  z-index: 12;
  display: grid;
  grid-template-columns: 112px;
  gap: 10px;
}

.touch-button {
  min-height: 54px;
  padding: 0 14px;
}

.touch-pause {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 12;
}

.mobile-hud-button {
  display: none;
}


@media (max-width: 780px) {
  body.mobile-player.touch-active .mobile-hud-button {
    position: fixed;
    left: 16px;
    z-index: 12;
    display: grid;
    place-items: center;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border-radius: 50%;
    background: rgba(19, 21, 22, 0.9);
    color: var(--ink);
    font-size: 19px;
    line-height: 1;
    box-shadow: 0 12px 26px var(--shadow);
    backdrop-filter: blur(10px);
    pointer-events: auto;
  }

  body.mobile-player.touch-active .mobile-needs-button {
    top: 18px;
    color: #ffd0d0;
  }

  body.mobile-player.touch-active .mobile-info-button {
    top: 72px;
    color: #d7ecff;
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 900;
  }

  body.mobile-player.touch-active #hud.mobile-needs-open .mobile-needs-button,
  body.mobile-player.touch-active #hud.mobile-info-open .mobile-info-button {
    background: var(--accent);
    color: #251d12;
  }

  .quest-panel {
    top: 74px;
    width: calc(100vw - 28px);
  }

  .minimap-panel {
    display: none;
  }

  .needs-panel,
  .status-panel {
    display: none;
    left: 14px;
    right: auto;
    width: min(288px, calc(100vw - 28px));
    max-height: calc(100vh - 210px);
    overflow: auto;
    z-index: 11;
  }

  #hud.mobile-needs-open .needs-panel {
    display: block;
    top: 126px;
    bottom: auto;
  }

  #hud.mobile-info-open .status-panel {
    display: block;
    top: 126px;
    bottom: auto;
  }

  .prompt-panel {
    bottom: 182px;
  }

  .context-menu {
    max-width: calc(100vw - 28px);
  }

  .context-actions button {
    min-height: 44px;
  }

  .action-panel {
    bottom: 238px;
  }

  .round-button {
    top: 18px;
    right: 120px;
  }

  body.mobile-player.touch-active .touch-joystick {
    height: min(46vh, 350px);
    min-height: 220px;
  }

  .slider-row {
    grid-template-columns: 1fr 54px auto;
  }

  .slider-row span {
    grid-column: 1 / -1;
  }

  .screen {
    padding: 12px;
  }

  .menu {
    max-height: calc(100dvh - 24px);
  }

  .storage-grid {
    grid-template-columns: 1fr;
  }

  .shop-row {
    grid-template-columns: 1fr;
  }

  .phone-app-grid {
    grid-template-columns: 1fr;
  }

  .shop-price {
    white-space: normal;
  }
}
