* { box-sizing: border-box; }
html { min-width: 320px; background: #09037d; }
body { margin: 0; min-height: 100vh; color: #111; font-family: var(--font-game), "Courier New", monospace; }
button, input { font: inherit; }
button { color: inherit; }

.desktop {
  position: relative;
  min-height: 100vh;
  padding: 26px 22px 74px;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 18%, #fff200 0 11px, transparent 12px),
    radial-gradient(circle at 84% 72%, #ff44b4 0 9px, transparent 10px),
    linear-gradient(135deg, transparent 0 46%, rgba(255,255,255,.08) 47% 53%, transparent 54%) 0 0/90px 90px,
    linear-gradient(135deg, #6620bc 0%, #0938a5 45%, #068e9c 100%);
}
.desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image: repeating-conic-gradient(#fff 0 25%, transparent 0 50%);
  background-size: 44px 44px;
  pointer-events: none;
}
.circus-shape { position: absolute; border: 7px solid #111; box-shadow: 8px 8px 0 rgba(0,0,0,.25); }
.shape-one { width: 82px; height: 82px; top: 7%; left: 2%; background: #ffdb00; transform: rotate(15deg); }
.shape-two { width: 72px; height: 72px; right: 2%; bottom: 12%; border-radius: 50%; background: #ff299b; }

.window {
  position: relative;
  z-index: 2;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 4px;
  background: #c0c0c0;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-right: 3px solid #171717;
  border-bottom: 3px solid #171717;
  box-shadow: 14px 14px 0 rgba(0,0,0,.32);
}
.titlebar {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 5px 4px 9px;
  color: #fff;
  background: linear-gradient(90deg, #000080, #1729d8 62%, #00a8e8);
}
.titlebar-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; letter-spacing: .02em; }
.window-buttons { display: flex; gap: 3px; }
.window-buttons span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 25px;
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #151515;
  border-bottom: 2px solid #151515;
}
.menu { display: flex; gap: 24px; min-height: 31px; align-items: center; padding: 0 10px; font-size: 12px; }
.menu span { cursor: default; }
.status-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  background: repeating-linear-gradient(90deg, #e80074 0 25px, #f5c400 25px 50px, #00a7b5 50px 75px, #6e20b9 75px 100px);
  text-shadow: 2px 2px 0 #111;
  border: 2px solid #111;
}
.program-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px; min-height: 670px; padding-top: 6px; }
.task-panel, .game-panel {
  background: #d7d7d7;
  border-top: 2px solid #777;
  border-left: 2px solid #777;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.task-panel { padding: 8px; }
.panel-title, .mini-title {
  padding: 7px 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  background: #000080;
}
.task-list { margin-top: 7px; background: #fff; border: 2px inset #eee; }
.task-item { display: grid; grid-template-columns: 20px 28px 1fr; gap: 5px; align-items: center; min-height: 34px; padding: 4px 8px; font-size: 10px; border-bottom: 1px dotted #999; }
.task-item.active { color: #fff; background: #000080; }
.task-item.done:not(.active) { color: #006400; background: #c9ffc9; }
.task-item b { color: #d10071; }
.task-item.active b { color: #fff200; }
.progress-box { margin-top: 12px; padding: 9px; font-size: 10px; background: #efefef; border: 2px outset #fff; }
.progress-box > span { font-weight: 900; }
.progress-box > div { height: 20px; margin: 7px 0 5px; padding: 2px; background: #fff; border: 2px inset #eee; }
.progress-box i { display: block; height: 100%; background: repeating-linear-gradient(90deg, #000080 0 11px, transparent 11px 13px); transition: width .25s; }
.progress-box b { display: block; text-align: right; }

.game-panel { padding: clamp(12px, 3vw, 28px); background: #ededed; }
.game-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.game-heading p { margin: 0 0 4px; color: #6b008d; font-size: 10px; font-weight: 900; }
h1 { margin: 0; color: #000080; font-size: clamp(25px, 5vw, 48px); line-height: 1; letter-spacing: -.08em; text-shadow: 3px 3px 0 #ffcf00; }
.difficulty { padding: 6px 8px; color: #111; font-size: 9px; font-weight: 900; background: #fff200; border: 2px solid #111; }
.hint-window { max-width: 700px; margin: 24px auto 0; background: #fff; border: 3px outset #fff; box-shadow: 4px 4px 0 #888; }
.hint-window .mini-title { background: linear-gradient(90deg, #7c008e, #e80074); }
.hint-window p { min-height: 74px; display: grid; place-items: center; margin: 0; padding: 18px; text-align: center; font-size: clamp(14px, 2.3vw, 18px); font-weight: 800; line-height: 1.45; }
.letter-row { display: flex; justify-content: center; flex-wrap: nowrap; gap: clamp(3px, 1vw, 9px); margin: 34px auto 10px; }
.letter {
  width: clamp(31px, 6.5vw, 58px);
  height: clamp(43px, 7.7vw, 68px);
  display: grid;
  place-items: center;
  color: #111;
  font-size: clamp(20px, 4vw, 36px);
  font-weight: 1000;
  background: #bdbdbd;
  border-top: 4px solid #777;
  border-left: 4px solid #777;
  border-right: 4px solid #fff;
  border-bottom: 4px solid #fff;
  box-shadow: 3px 3px 0 rgba(0,0,0,.25);
}
.letter.visible { color: #fff; background: #000080; text-shadow: 3px 3px 0 #000; }
.letter.visible:nth-child(3n+2) { background: #d90077; }
.letter.visible:nth-child(3n) { color: #111; background: #ffdc00; text-shadow: none; }
.letter.solved { animation: letter-party .35s both; }
.letter-count { margin: 0 0 25px; color: #555; text-align: center; font-size: 9px; font-weight: 900; }
.controls-row { display: flex; justify-content: center; align-items: stretch; gap: 12px; margin-bottom: 22px; }
.win-button {
  min-height: 42px;
  padding: 8px 15px;
  font-size: 11px;
  font-weight: 900;
  background: #c0c0c0;
  border-top: 3px solid #fff;
  border-left: 3px solid #fff;
  border-right: 3px solid #111;
  border-bottom: 3px solid #111;
  box-shadow: 1px 1px 0 #000;
  cursor: pointer;
}
.win-button:active { border: 3px inset #ddd; transform: translate(1px, 1px); }
.win-button:focus-visible, input:focus-visible { outline: 3px dotted #111; outline-offset: 2px; }
.win-button:disabled { color: #777; text-shadow: 1px 1px #fff; cursor: not-allowed; }
.reveal-button { display: flex; align-items: center; gap: 7px; background: #ffde2c; }
.reveal-button small { display: block; margin-left: 4px; color: #8d0054; font-size: 8px; }
.points-now { display: grid; place-items: center; padding: 6px 12px; font-size: 9px; text-align: center; background: #fff; border: 2px inset #eee; }
.points-now b { display: block; color: #e00078; font-size: 20px; }
.answer-form { width: min(680px, 100%); margin: 0 auto; }
.answer-form label { display: block; margin-bottom: 7px; color: #000080; font-size: 10px; font-weight: 900; }
.answer-form > div { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.answer-form input { min-width: 0; height: 48px; padding: 0 13px; color: #111; font-size: 14px; background: #fff; border: 3px inset #eee; border-radius: 0; }
.answer-form input::placeholder { color: #777; }
.check-button { color: #fff; background: #00827e; }
.message { display: flex; align-items: center; justify-content: center; gap: 8px; width: min(680px, 100%); margin: 13px auto 0; padding: 9px; font-size: 11px; font-weight: 900; border: 2px solid #111; }
.message.error { color: #fff; background: #d90041; animation: shake .23s; }
.message.success { margin: 0 0 13px; color: #111; background: #5fff80; }
.success-card { display: grid; grid-template-columns: 1fr 176px; gap: 18px; align-items: center; width: min(680px, 100%); margin: 17px auto 0; padding: 14px; background: #fff; border: 3px outset #eee; animation: pop-in .25s ease-out; }
.success-copy { text-align: left; }
.success-copy h2 { margin: 0; color: #000080; font-size: clamp(23px, 4vw, 37px); }
.success-copy p { margin: 7px 0 14px; font-size: 10px; }
.next-button { color: #fff; background: #7c008e; }
.success-card figure { margin: 0; }
.result-picture { width: 176px; aspect-ratio: 4 / 5; background-image: url('/result-sprites.png?v=tadc-1'); background-repeat: no-repeat; background-size: 500% 200%; border: 4px ridge #fff; box-shadow: 5px 5px 0 #111; }
.success-card figcaption { margin-top: 7px; font-size: 8px; text-align: center; }
.window-footer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 4px; align-items: center; margin-top: 5px; font-size: 9px; }
.window-footer > * { min-height: 27px; display: flex; align-items: center; gap: 6px; padding: 4px 7px; background: #c0c0c0; border: 2px inset #eee; }
.window-footer button { cursor: pointer; }

.taskbar { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; height: 48px; display: grid; grid-template-columns: auto minmax(140px, 310px) 1fr; gap: 6px; padding: 5px; background: #c0c0c0; border-top: 3px solid #fff; }
.start-button, .taskbar-app, .tray { display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 11px; border: 3px outset #eee; }
.start-button { font-size: 13px; }
.taskbar-app { background: #eee; border: 3px inset #eee; }
.tray { justify-self: end; }
.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.55); }
.finish-window { width: min(500px, 100%); padding: 4px; background: #c0c0c0; border: 3px outset #fff; box-shadow: 16px 16px 0 rgba(0,0,0,.45); animation: pop-in .25s ease-out; }
.finish-body { padding: 28px; text-align: center; background: repeating-conic-gradient(#f8c900 0 25%, #fff 0 50%) 0 0/24px 24px; border: 2px inset #eee; }
.finish-body > * { width: fit-content; margin-left: auto; margin-right: auto; padding: 5px 12px; background: #fff; }
.finish-star { color: #e00078; font-size: 58px; line-height: 1; text-shadow: 4px 4px 0 #000080; }
.finish-body h2 { color: #000080; font-size: 20px; }
.finish-body p { margin-bottom: 0; font-size: 10px; }
.finish-body strong { display: block; color: #e00078; font-size: 40px; }
.finish-body .win-button { display: block; margin-top: 17px; background: #5fff80; }

@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes letter-party { 50% { transform: translateY(-8px) rotate(3deg); } }

@media (max-width: 760px) {
  .desktop { padding: 10px 7px 66px; overflow: auto; }
  .program-body { grid-template-columns: 1fr; }
  .task-panel { order: 2; }
  .task-list { display: grid; grid-template-columns: repeat(5, 1fr); }
  .task-item { grid-template-columns: 16px 22px; padding: 3px; }
  .task-item span:last-child { display: none; }
  .game-panel { order: 1; }
  .success-card { grid-template-columns: 1fr; text-align: center; }
  .success-copy { text-align: center; }
  .success-card figure { margin: 0 auto; }
}

@media (max-width: 520px) {
  .menu { gap: 14px; }
  .status-strip span { max-width: 190px; }
  .game-heading { display: block; }
  .difficulty { display: inline-block; margin-top: 10px; }
  .letter { border-width: 2px; }
  .controls-row { flex-direction: column; }
  .answer-form > div { grid-template-columns: 1fr; }
  .taskbar { grid-template-columns: auto 1fr; }
  .tray { display: none; }
  .result-picture { width: 155px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
