:root {
  --bg: #101419;
  --panel: #182029;
  --panel-2: #202a35;
  --ink: #f2f6f3;
  --muted: #9eacb4;
  --line: #303c47;
  --teal: #40d5c4;
  --teal-dark: #1f8f88;
  --amber: #f5b84b;
  --green: #79d279;
  --red: #ff7468;
  --blue: #78a8ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 720px;
  min-height: 420px;
  background:
    radial-gradient(circle at 28% 14%, rgba(64, 213, 196, 0.14), transparent 30%),
    linear-gradient(135deg, #0d1117 0%, #131922 48%, #1d201c 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.55;
}

.game-shell {
  width: min(1440px, 100vw);
  height: min(820px, 100dvh);
  min-height: 420px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-rows: 78px 1fr 74px;
  gap: 14px;
}

.topbar,
.bottom-bar,
.studio-panel,
.shop-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 32, 41, 0.9);
  box-shadow: var(--shadow);
}

.topbar {
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.eyeline {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1;
}

h2 {
  font-size: 25px;
  line-height: 1.1;
}

.calendar {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.calendar strong {
  color: var(--amber);
  font-size: 17px;
}

.playfield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 28vw, 372px);
  gap: 14px;
  min-height: 0;
}

.studio-panel,
.shop-panel {
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
}

.studio-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding: 16px;
}

.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.studio-header p {
  color: var(--muted);
  margin-top: 5px;
  font-size: 14px;
}

.primary-button,
.ship-button,
.ghost-button,
.buy-button {
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button {
  min-width: 128px;
  background: linear-gradient(180deg, #51e1d3, #24a89d);
  color: #071313;
  box-shadow: 0 10px 26px rgba(64, 213, 196, 0.26);
}

.primary-button:active,
.ship-button:active,
.ghost-button:active,
.buy-button:active {
  transform: translateY(1px) scale(0.99);
}

.project-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.meter-row {
  display: grid;
  grid-template-columns: 72px 1fr 76px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.meter-row strong {
  text-align: right;
  color: var(--muted);
}

.meter {
  height: 13px;
  border-radius: 999px;
  background: #111820;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 180ms ease;
}

.office-scene {
  position: relative;
  min-height: 250px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(120, 168, 255, 0.11), transparent 42%),
    linear-gradient(160deg, #26313d 0 36%, #202731 36% 58%, #171e26 58%);
  border: 1px solid var(--line);
}

.office-scene::before {
  content: "";
  position: absolute;
  inset: 45% -10% -20% -10%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 36px;
  transform: perspective(420px) rotateX(52deg);
  transform-origin: top;
}

.wall-board {
  position: absolute;
  top: 22px;
  left: 28px;
  width: 190px;
  height: 86px;
  border-radius: 5px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #dfeee8;
  color: #1b2b2d;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.24);
  font-size: 11px;
  font-weight: 800;
}

.wall-board span {
  grid-column: 1 / -1;
  color: #1e6d66;
}

.wall-board i {
  border-top: 4px solid var(--teal-dark);
  background: rgba(31, 143, 136, 0.12);
  font-style: normal;
  padding-top: 4px;
}

.poster {
  position: absolute;
  top: 24px;
  width: 66px;
  height: 88px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.22);
}

.poster-a {
  right: 170px;
  background: #f5b84b;
  color: #21160a;
}

.poster-b {
  right: 86px;
  background: #78a8ff;
  color: #101724;
}

.desk-grid {
  position: absolute;
  top: 112px;
  left: 34px;
  right: 136px;
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  grid-auto-rows: minmax(72px, 1fr);
  gap: 10px 18px;
  align-items: end;
}

.desk {
  position: relative;
  height: 72px;
}

.desk::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 7px;
  height: 23px;
  border-radius: 5px;
  background: linear-gradient(180deg, #9a6743, #6d432d);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.24);
}

.monitor {
  position: absolute;
  left: 50%;
  bottom: 31px;
  width: 38px;
  height: 27px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #071116;
  border: 3px solid #2d3b46;
  box-shadow: 0 0 20px rgba(64, 213, 196, 0.32);
}

.monitor::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--teal), #254b57);
  opacity: 0.8;
}

.dev {
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 20px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 14px 14px 8px 8px;
  background: var(--amber);
}

.dev::before {
  content: "";
  position: absolute;
  top: -13px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #f1c7a4;
}

.bubble {
  position: absolute;
  top: -2px;
  left: 50%;
  min-width: 42px;
  transform: translateX(-50%);
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(64, 213, 196, 0.16);
  color: var(--teal);
  border: 1px solid rgba(64, 213, 196, 0.35);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.desk-grid.labels-hover .bubble {
  animation: label-hover 1.7s ease-in-out infinite;
}

.coffee-station {
  position: absolute;
  right: 28px;
  bottom: 36px;
  width: 84px;
  height: 104px;
  border-radius: 6px;
  padding: 12px 10px;
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 8px;
  background: #2f2520;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.coffee-station span {
  width: 38px;
  height: 48px;
  border-radius: 6px 6px 12px 12px;
  background: linear-gradient(180deg, #4f5b64, #1e252b);
  box-shadow: inset 0 0 0 5px #11181f;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

.ship-button {
  background: linear-gradient(180deg, #ffc95f, #d78d21);
  color: #211607;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink);
}

.shop-panel {
  display: grid;
  grid-template-rows: 50px 1fr;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.tab.active {
  background: rgba(64, 213, 196, 0.13);
  color: var(--teal);
  box-shadow: inset 0 -3px 0 var(--teal);
}

.shop-list {
  overflow: auto;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.shop-item {
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.shop-item h3 {
  margin: 0;
  font-size: 15px;
}

.shop-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.shop-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.buy-button {
  min-height: 36px;
  padding: 0 12px;
  background: rgba(64, 213, 196, 0.16);
  border: 1px solid rgba(64, 213, 196, 0.35);
  color: var(--teal);
}

.stat-card {
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-section {
  display: grid;
  gap: 8px;
}

.history-section h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 14px;
}

.milestone-list,
.release-list {
  display: grid;
  gap: 8px;
}

.milestone-item,
.release-item,
.empty-history {
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.milestone-item {
  display: grid;
  gap: 8px;
}

.milestone-item strong,
.release-item strong {
  display: block;
  font-size: 13px;
}

.milestone-item span,
.release-item span,
.empty-history {
  color: var(--muted);
  font-size: 12px;
}

.milestone-item.claimed {
  border-color: rgba(64, 213, 196, 0.35);
  background: rgba(64, 213, 196, 0.08);
}

.milestone-meta,
.release-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.milestone-meta small {
  color: var(--amber);
  font-size: 11px;
  font-weight: 900;
}

.mini-meter {
  height: 7px;
  border-radius: 999px;
  background: #111820;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.release-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.release-meta span {
  color: var(--ink);
  font-weight: 800;
}

.setting-row {
  min-height: 58px;
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.danger-row {
  border-color: rgba(255, 116, 104, 0.28);
}

.build-row {
  border-color: rgba(245, 184, 75, 0.32);
  background: rgba(245, 184, 75, 0.08);
}

.build-row strong {
  color: var(--amber);
}

.setting-row strong {
  display: block;
  font-size: 15px;
}

.setting-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #111820;
  border: 1px solid var(--line);
  transition: background 160ms ease, border-color 160ms ease;
}

.switch i::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + i {
  background: rgba(64, 213, 196, 0.16);
  border-color: rgba(64, 213, 196, 0.45);
}

.switch input:checked + i::after {
  transform: translateX(22px);
  background: var(--teal);
}

.danger-button {
  min-height: 34px;
  border-radius: 7px;
  padding: 0 12px;
  background: rgba(255, 116, 104, 0.14);
  border: 1px solid rgba(255, 116, 104, 0.42);
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

@keyframes label-hover {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-4px);
  }
}


.bottom-bar {
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
}

.bottom-bar div {
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  border-right: 1px solid var(--line);
}

.bottom-bar div:last-child {
  border-right: 0;
}

.bottom-bar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bottom-bar strong {
  font-size: 21px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(24px);
  max-width: min(620px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.92);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 14px;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.save-indicator {
  position: fixed;
  right: 18px;
  bottom: 92px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(64, 213, 196, 0.13);
  color: var(--teal);
  border: 1px solid rgba(64, 213, 196, 0.38);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

.float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(8, 12, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  animation: float-number 900ms ease-out forwards;
  white-space: nowrap;
}

.float-text.art {
  color: var(--amber);
}

.float-text.design {
  color: var(--blue);
}

.float-text.hype {
  color: var(--red);
}

@keyframes float-number {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.92);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -130%) scale(1);
  }
}

@media (max-width: 1050px) {
  .game-shell {
    padding: 12px;
    gap: 10px;
  }

  .playfield {
    grid-template-columns: minmax(0, 1fr) 315px;
  }

  .desk-grid {
    grid-template-columns: repeat(3, minmax(84px, 1fr));
  }
}

@media (max-width: 860px), (max-height: 560px) {
  body {
    min-width: 720px;
  }

  .game-shell {
    padding: 8px;
    grid-template-rows: 54px 1fr 54px;
    gap: 8px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .eyeline {
    display: none;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  .calendar {
    font-size: 11px;
    gap: 2px;
  }

  .calendar strong {
    font-size: 13px;
  }

  .playfield {
    grid-template-columns: minmax(0, 1fr) 286px;
    gap: 8px;
  }

  .studio-panel {
    padding: 9px;
    gap: 8px;
  }

  .studio-header {
    gap: 10px;
  }

  .studio-header p {
    display: none;
  }

  .primary-button,
  .ship-button,
  .ghost-button,
  .buy-button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 12px;
  }

  .primary-button {
    min-width: 88px;
  }

  .project-card {
    padding: 8px;
    gap: 7px;
  }

  .meter-row {
    grid-template-columns: 52px 1fr 62px;
    gap: 7px;
    font-size: 11px;
  }

  .meter {
    height: 10px;
  }

  .office-scene {
    min-height: 160px;
  }

  .wall-board {
    top: 12px;
    left: 16px;
    width: 144px;
    height: 64px;
    padding: 8px;
    gap: 4px;
    font-size: 9px;
  }

  .wall-board i {
    border-top-width: 3px;
    padding-top: 3px;
  }

  .poster {
    top: 14px;
    width: 48px;
    height: 62px;
    font-size: 10px;
  }

  .poster-a {
    right: 118px;
  }

  .poster-b {
    right: 58px;
  }

  .desk-grid {
    top: 78px;
    left: 18px;
    right: 92px;
    bottom: 10px;
    grid-template-columns: repeat(4, minmax(60px, 1fr));
    grid-auto-rows: minmax(50px, 1fr);
    gap: 7px 10px;
  }

  .desk {
    height: 50px;
  }

  .desk::before {
    left: 8px;
    right: 8px;
    bottom: 4px;
    height: 16px;
  }

  .monitor {
    bottom: 22px;
    width: 28px;
    height: 20px;
    border-width: 2px;
  }

  .monitor::after {
    inset: 4px;
  }

  .dev {
    bottom: 5px;
    width: 15px;
    height: 21px;
  }

  .dev::before {
    top: -10px;
    left: 2px;
    width: 12px;
    height: 12px;
  }

  .bubble {
    top: -5px;
    min-width: 32px;
    padding: 3px 5px;
    font-size: 9px;
  }

  .coffee-station {
    right: 14px;
    bottom: 14px;
    width: 58px;
    height: 76px;
    padding: 8px 6px;
    gap: 5px;
    font-size: 10px;
  }

  .coffee-station span {
    width: 28px;
    height: 36px;
    box-shadow: inset 0 0 0 4px #11181f;
  }

  .action-row {
    gap: 6px;
  }

  .shop-panel {
    grid-template-rows: 40px 1fr;
  }

  .tab {
    font-size: 11px;
  }

  .shop-list {
    padding: 8px;
    gap: 7px;
  }

  .shop-item,
  .stat-card,
  .milestone-item,
  .release-item,
  .setting-row {
    padding: 8px;
    border-radius: 7px;
  }

  .shop-item {
    gap: 7px;
  }

  .shop-item h3,
  .setting-row strong {
    font-size: 12px;
  }

  .shop-item p,
  .setting-row span,
  .milestone-item span,
  .release-item span,
  .empty-history {
    font-size: 10px;
  }

  .shop-meta,
  .milestone-meta,
  .release-meta {
    font-size: 10px;
  }

  .stat-grid {
    gap: 7px;
  }

  .stat-card strong {
    font-size: 15px;
  }

  .bottom-bar div {
    padding: 9px 10px;
  }

  .bottom-bar span {
    font-size: 10px;
  }

  .bottom-bar strong {
    font-size: 15px;
  }

  .toast {
    bottom: 66px;
    font-size: 12px;
  }

  .save-indicator {
    right: 10px;
    bottom: 66px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  body {
    min-width: 640px;
  }

  .game-shell {
    grid-template-rows: 48px 1fr 48px;
  }

  .playfield {
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .shop-panel {
    grid-template-rows: 64px 1fr;
  }

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

  .office-scene {
    min-height: 132px;
  }

  .desk-grid {
    top: 70px;
    grid-template-columns: repeat(4, minmax(48px, 1fr));
  }

  .wall-board {
    width: 124px;
  }

  .poster {
    display: none;
  }
}

@media (max-width: 760px) and (orientation: portrait) and (pointer: coarse) {
  body::before {
    content: "Rotate to landscape for the studio layout";
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    background: rgba(13, 17, 23, 0.96);
    color: var(--ink);
    font-size: 24px;
    font-weight: 900;
    text-align: center;
    padding: 30px;
  }
}

@media (max-width: 760px) and (orientation: portrait) and (pointer: fine) {
  body {
    min-width: 520px;
    overflow: auto;
  }

  .game-shell {
    width: 100vw;
    height: auto;
    min-height: 100dvh;
    grid-template-rows: 52px auto 58px;
  }

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

  .shop-panel {
    min-height: 360px;
  }
}
