:root {
  color-scheme: light;
  --ink: #263047;
  --muted: #596174;
  --panel: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 38px rgba(42, 54, 92, 0.18);
  --blue: #3f8cff;
  --teal: #12bfa6;
  --pink: #ff6d9f;
  --yellow: #ffdc51;
  --paper: #fffdf2;
}

* {
  box-sizing: border-box;
}

html {
  background: #dff7ff;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 14px;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 220, 81, 0.86) 0 8vw, transparent calc(8vw + 2px)),
    radial-gradient(circle at 87% 18%, rgba(18, 191, 166, 0.45) 0 9vw, transparent calc(9vw + 2px)),
    radial-gradient(circle at 80% 88%, rgba(255, 109, 159, 0.42) 0 10vw, transparent calc(10vw + 2px)),
    linear-gradient(135deg, #88e2ff 0%, #f9f6a8 40%, #ffc2d9 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
.screen:focus-visible {
  outline: 4px solid #263047;
  outline-offset: 3px;
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  width: min(1240px, calc(100vw - 28px));
  height: min(880px, calc(100dvh - 28px));
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(190px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.home-link {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  color: white;
  background: #ff6d9f;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15), 0 5px 0 rgba(38, 48, 71, 0.14);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
}

.title-block {
  min-width: 0;
}

.title-block p,
.printer-head p {
  margin: 0 0 2px;
  color: #0d7174;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
}

h2 {
  font-size: 1.55rem;
}

.status-pill,
.page-count {
  justify-self: end;
  max-width: 100%;
  padding: 12px 15px;
  border-radius: 8px;
  color: white;
  background: #2357c9;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16);
  font-size: 1rem;
  font-weight: 950;
  text-align: center;
}

.office {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
  gap: 14px;
}

.computer-area,
.printer-card {
  min-width: 0;
  min-height: 0;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.computer-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
}

.monitor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 8px solid #263047;
  border-radius: 8px;
  background: #263047;
  box-shadow: 0 14px 0 rgba(38, 48, 71, 0.16);
}

.monitor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  color: white;
  background: #374361;
}

.monitor-bar strong {
  overflow: hidden;
  margin-left: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.dot.red {
  background: #ff657d;
}

.dot.yellow {
  background: #ffd95c;
}

.dot.green {
  background: #54dc8d;
}

.screen {
  position: relative;
  min-height: 0;
  padding: clamp(18px, 3vw, 30px);
  overflow: auto;
  color: #132440;
  background:
    linear-gradient(90deg, rgba(63, 140, 255, 0.09) 0 2px, transparent 2px 42px),
    linear-gradient(#fffdf2 0 48px, #e4f6ff 49px 50px, #fffdf2 51px);
  background-size: 42px 100%, 100% 50px;
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  font-weight: 950;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.screen::before {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: rgba(19, 36, 64, 0.16);
  content: "WORK MODE";
  font-size: clamp(1rem, 2vw, 1.55rem);
  font-weight: 1000;
  pointer-events: none;
}

.typed-text:empty::before {
  color: rgba(19, 36, 64, 0.38);
  content: "Click keys or type here...";
}

.cursor {
  display: inline-block;
  width: 0.12em;
  height: 1.05em;
  margin-left: 0.08em;
  border-radius: 999px;
  background: #2357c9;
  vertical-align: -0.12em;
  animation: blink 900ms steps(2, start) infinite;
}

.keyboard-panel {
  display: grid;
  gap: 10px;
}

.keyboard {
  display: grid;
  gap: 8px;
}

.key-row {
  display: grid;
  gap: 8px;
}

.key-row.row-1 {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.key-row.row-2 {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  padding-inline: 4%;
}

.key-row.row-3 {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding-inline: 12%;
}

.letter-key,
.wide-key,
.tool-key,
.print-button {
  min-height: 54px;
  border-radius: 8px;
  color: #263047;
  background: white;
  box-shadow: inset 0 -6px 0 rgba(38, 48, 71, 0.13), 0 5px 0 rgba(38, 48, 71, 0.15);
  font-weight: 1000;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.letter-key {
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.letter-key:hover,
.wide-key:hover,
.tool-key:hover,
.print-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.letter-key:active,
.letter-key.active,
.wide-key:active,
.tool-key:active,
.print-button:active,
.print-button.printing {
  transform: translateY(3px);
  box-shadow: inset 0 -3px 0 rgba(38, 48, 71, 0.12), 0 2px 0 rgba(38, 48, 71, 0.14);
}

.desk-actions {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto auto auto;
  gap: 8px;
}

.wide-key {
  background: #b8f5e6;
}

.tool-key {
  min-width: 112px;
  padding-inline: 14px;
  background: #ffe88c;
}

.tool-key.danger {
  background: #ffacc5;
}

.tool-key.quiet {
  background: #dce9ff;
}

.shift-key {
  background: #d8c8ff;
}

.shift-key.is-on {
  color: white;
  background: #6b51d9;
}

.printer-area {
  min-height: 0;
}

.printer-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  gap: 12px;
  padding: 14px;
}

.printer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.page-count {
  padding: 10px 12px;
  background: #0f8b77;
  font-size: 0.9rem;
}

.printer-stage {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.48) 0 22px, transparent 22px 44px),
    #e7f7ff;
}

.printed-stack {
  position: absolute;
  inset: 12px 24px 150px;
  pointer-events: none;
}

.paper {
  position: absolute;
  right: 2px;
  bottom: 0;
  width: min(210px, 78%);
  min-height: 148px;
  padding: 18px 16px 14px;
  border: 3px solid rgba(38, 48, 71, 0.12);
  border-radius: 5px;
  color: #263047;
  background:
    linear-gradient(#fffdf2 0 24px, #d6edff 25px 26px, #fffdf2 27px);
  background-size: 100% 27px;
  box-shadow: 0 10px 0 rgba(38, 48, 71, 0.11), 0 18px 28px rgba(38, 48, 71, 0.18);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transform: translateY(140px) rotate(var(--tilt));
  animation: printOut 900ms cubic-bezier(0.2, 0.9, 0.2, 1.1) forwards;
}

.paper.old {
  opacity: 0.76;
}

.paper::before {
  display: block;
  margin-bottom: 7px;
  color: #2357c9;
  content: "Printed Work";
  font-size: 0.72rem;
  text-transform: uppercase;
}

.printer {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  height: 142px;
  border: 5px solid rgba(38, 48, 71, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 86% 26%, #54dc8d 0 9px, transparent 10px),
    linear-gradient(#f6fbff 0 44%, #c7d9ee 45% 100%);
  box-shadow: inset 0 -10px 0 rgba(38, 48, 71, 0.12), 0 11px 0 rgba(38, 48, 71, 0.15);
}

.printer-light {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #54dc8d;
  box-shadow: 0 0 0 6px rgba(84, 220, 141, 0.22);
}

.printer.printing .printer-light {
  animation: glow 220ms ease-in-out infinite alternate;
}

.printer-slot {
  position: absolute;
  top: 42px;
  left: 28px;
  width: 58%;
  height: 18px;
  border-radius: 999px;
  background: #263047;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.18);
}

.printer-mouth {
  position: absolute;
  right: 28px;
  bottom: 28px;
  left: 28px;
  height: 18px;
  border-radius: 999px;
  background: #8ba4c2;
}

.print-button {
  position: absolute;
  right: 24px;
  bottom: 54px;
  min-height: 48px;
  padding: 0 22px;
  color: white;
  background: #2357c9;
}

.printer-hint {
  min-height: 2.6em;
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.3;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes printOut {
  0% {
    opacity: 0.7;
    transform: translateY(140px) rotate(var(--tilt));
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotate(var(--tilt));
  }
}

@keyframes glow {
  to {
    background: #ffdc51;
    box-shadow: 0 0 0 9px rgba(255, 220, 81, 0.28);
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .game-shell {
    height: auto;
    min-height: calc(100vh - 28px);
  }

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

  .printer-stage {
    min-height: 360px;
  }
}

@media (max-width: 700px) {
  .topbar {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .status-pill {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .desk-actions {
    grid-template-columns: 1fr 1fr;
  }

  .tool-key {
    min-width: 0;
  }

  .key-row.row-1,
  .key-row.row-2,
  .key-row.row-3 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-inline: 0;
  }
}
