:root {
  --desktop: #008080;
  --desktop-deep: #006b6b;
  --panel: #c0c0c0;
  --panel-light: #dfdfdf;
  --panel-dark: #a8a8a8;
  --bevel-light: #ffffff;
  --bevel-dark: #404040;
  --bevel-black: #000000;
  --titlebar: #000080;
  --titlebar-2: #1084d0;
  --titlebar-text: #ffffff;
  --ink: #000000;
  --ink-soft: #2b2b2b;
  --ember: #ff7a1a;
  --ember-deep: #b23000;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  padding-bottom: 44px;
  background-color: var(--desktop);
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px);
  color: var(--ink);
  font-family: 'Times New Roman', Times, serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.desktop {
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 8px;
}

[hidden] {
  display: none !important;
}

.window {
  width: min(640px, 100%);
  background: var(--panel);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-black) var(--bevel-black) var(--bevel-light);
  box-shadow: 2px 2px 0 0 var(--bevel-dark);
}

.title-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 3px 3px 3px 6px;
  background: linear-gradient(90deg, var(--titlebar) 0%, var(--titlebar) 70%, var(--titlebar-2) 100%);
  color: var(--titlebar-text);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.3;
}

.title-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget,
.close {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 18px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-black) var(--bevel-black) var(--bevel-light);
  box-shadow: inset -1px -1px 0 0 var(--bevel-dark);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.widget:hover,
.close:hover {
  background: var(--panel-light);
}

.close:active,
.widget:active {
  border-color: var(--bevel-black) var(--bevel-light) var(--bevel-light) var(--bevel-black);
  box-shadow: inset 1px 1px 0 0 var(--bevel-dark);
}

.menu-bar {
  display: flex;
  gap: 2px;
  padding: 2px 4px;
  background: var(--panel);
  border-bottom: 1px solid var(--bevel-dark);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 13px;
}

.menu {
  position: relative;
}

.menu-trigger {
  min-height: 26px;
  padding: 2px 9px;
  background: none;
  border: 1px solid transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.menu-trigger:hover,
.menu.open .menu-trigger {
  background: var(--titlebar);
  color: #fff;
}

.menu-popup {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  display: none;
  min-width: 190px;
  padding: 2px;
  background: var(--panel);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-black) var(--bevel-black) var(--bevel-light);
  box-shadow: 2px 2px 0 0 var(--bevel-dark);
}

.menu.open .menu-popup {
  display: block;
}

.menu-popup button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 4px 10px;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.menu-popup button:hover {
  background: var(--titlebar);
  color: #fff;
}

.window-body {
  padding: 14px;
}

.intro {
  margin: 0 0 12px;
}

.fineprint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.warning {
  margin: 0 0 12px;
  padding: 8px;
  background: var(--panel-light);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  font-weight: bold;
}

.field {
  margin: 0 0 12px;
  min-width: 0;
}

label,
legend {
  display: block;
  margin-bottom: 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
}

textarea,
input[type='text'],
select {
  width: 100%;
  padding: 6px;
  background: #fff;
  color: var(--ink);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  line-height: 1.4;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

textarea::placeholder {
  color: #6a6a6a;
  animation: caret 1.1s steps(1, end) infinite;
}

@keyframes caret {
  0%,
  49% {
    border-right: 2px solid #6a6a6a;
  }
  50%,
  100% {
    border-right: 2px solid transparent;
  }
}

:focus-visible {
  outline: 2px dotted var(--bevel-black);
  outline-offset: 2px;
}

.mode-field {
  margin: 0 0 12px;
  padding: 8px;
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
}

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

.mode {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px;
  background: var(--panel-light);
  border: 1px solid var(--bevel-dark);
  cursor: pointer;
}

.mode input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--titlebar);
}

.mode-body {
  display: block;
  min-width: 0;
}

.mode-name {
  display: block;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
}

.mode-note {
  display: block;
  font-family: 'Times New Roman', Times, serif;
  font-size: 12px;
  font-weight: normal;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 16px;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-black) var(--bevel-black) var(--bevel-light);
  box-shadow: 1px 1px 0 0 var(--bevel-dark);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 15px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--panel-light);
}

.button:active {
  border-color: var(--bevel-black) var(--bevel-light) var(--bevel-light) var(--bevel-black);
  box-shadow: none;
  transform: translate(1px, 1);
}

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

.button[disabled] {
  color: #6a6a6a;
  cursor: default;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.message {
  margin: 10px 0 0;
  min-height: 1.45em;
  font-size: 14px;
  font-weight: bold;
}

.message[data-tone='warn'] {
  color: #7a0000;
}

.message[data-tone='ok'] {
  color: #004000;
}

.tagline {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.note-text {
  margin: 0 0 12px;
  padding: 10px;
  max-height: 340px;
  overflow: auto;
  background: #fff;
  color: var(--ink);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.burn-actions {
  margin-top: 14px;
  text-align: center;
}

.burn-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.stage {
  margin: 0 0 4px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--titlebar);
}

#phase-box {
  position: relative;
  text-align: center;
}

#phase-box .intro {
  text-align: left;
}

#gate {
  text-align: center;
}

.flame,
.flame-static {
  margin: 4px auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  line-height: 1.05;
  white-space: pre;
  color: var(--ember-deep);
}

/* The live burn is the main event, so it gets more room and a glow than the
   end state does. Sized in vw so the art never wraps on a narrow screen. */
#flame {
  font-size: clamp(11px, 3.6vw, 20px);
  text-shadow: 0 0 14px rgba(255, 140, 0, 0.4);
  animation: flicker 0.44s steps(2, end) infinite;
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.82;
  }
}

.embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ember {
  position: absolute;
  left: 50%;
  bottom: 20%;
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--size, 6px);
  line-height: 1;
  color: var(--ember);
  opacity: 0;
  animation: rise 2.4s ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes rise {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--drift, 0), calc(-1 * var(--rise, 100px))) scale(1);
  }
}

.progress-block {
  text-align: center;
}

.progress-label {
  margin: 0 0 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
}

.progress-fill {
  --progress: 0%;
  width: 100%;
  height: 22px;
  padding: 2px;
  background: var(--panel);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
}

.progress-fill::before {
  content: '';
  display: block;
  width: var(--progress);
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--ember) 0 8px, var(--ember-deep) 8px 16px);
  transition: width 90ms linear;
}

.countdown {
  margin: 8px 0 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: bold;
  color: var(--ember-deep);
}

.burned-notice,
.gone-notice {
  padding: 8px 0;
  text-align: center;
}

.burned-line {
  margin: 8px 0;
  font-size: 20px;
  font-weight: bold;
}

.status-bar {
  display: flex;
  gap: 3px;
  margin: 6px 2px 2px;
}

.status-cell {
  padding: 3px 6px;
  background: var(--panel);
  border: 1px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 12px;
  white-space: nowrap;
}

.status-cell.grow {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tick {
  animation: tick 320ms steps(4, end);
}

@keyframes tick {
  0% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

.window-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 10px;
  font-size: 11px;
}

.window-footer .badge {
  margin-left: auto;
}

.link-button {
  min-height: 44px;
  padding: 0 6px;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.badge {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.ticker {
  width: min(640px, 100%);
  overflow: hidden;
  padding: 3px 0;
  background: var(--bevel-black);
  color: #33ff33;
  border: 1px solid var(--desktop-deep);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  white-space: nowrap;
}

.ticker-track {
  display: inline-block;
  padding-left: 100%;
  animation: scroll 28s linear infinite;
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 6px;
  background: var(--panel-dark);
  border-top: 2px solid var(--bevel-light);
  font-family: 'Arial', Helvetica, sans-serif;
  font-size: 12px;
}

.start-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 10px;
  background: var(--panel);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-black) var(--bevel-black) var(--bevel-light);
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.start-button:hover,
.start-menu.open .start-button {
  background: var(--titlebar);
  color: #fff;
}

/* The taskbar hugs the bottom edge, so its popup opens upward. */
.start-menu {
  flex: 0 0 auto;
}

.start-menu .menu-popup {
  top: auto;
  bottom: calc(100% + 2px);
  left: 0;
}

.start-flame {
  width: 11px;
  height: 14px;
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, #ffd23f 0%, #ff8a1f 55%, #ff4500 100%);
  clip-path: polygon(
    50% 0%,
    78% 30%,
    66% 38%,
    88% 62%,
    72% 100%,
    28% 100%,
    12% 62%,
    34% 38%,
    22% 30%
  );
}

.taskbar-sep {
  width: 1px;
  height: 26px;
  background: var(--bevel-dark);
  box-shadow: 1px 0 0 var(--bevel-light);
}

.taskbar-item {
  padding: 3px 7px;
  background: var(--panel);
  border: 1px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  white-space: nowrap;
}

.taskbar-spacer {
  flex: 1 1 auto;
}

.taskbar-clock {
  padding: 3px 8px;
  background: var(--panel);
  border: 1px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  font-variant-numeric: tabular-nums;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 24px;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.55), transparent 58%),
    radial-gradient(circle at 78% 92%, rgba(0, 30, 90, 0.55), transparent 60%),
    linear-gradient(103deg, #0b3d9e 0%, #2f8fe8 16%, #1a6fd4 38%, #0d4bb0 62%, #0a3a8c 100%);
}

.boot.leaving {
  opacity: 0;
  transition: opacity 420ms ease-out;
}

.boot-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #fff;
}

.boot-logo {
  display: block;
  width: clamp(86px, 22vw, 126px);
  height: auto;
  margin-bottom: 18px;
  overflow: visible;
  filter: drop-shadow(0 10px 14px rgba(0, 18, 55, 0.5));
  animation: logo-float 3.4s ease-in-out infinite;
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.boot-wordmark {
  position: relative;
  padding-bottom: 10px;
  font-size: clamp(38px, 9vw, 72px);
  font-style: italic;
  font-weight: bold;
  letter-spacing: -0.015em;
  line-height: 1;
  text-shadow:
    0 1px 0 #dbe9ff,
    2px 3px 0 #0a2a6b,
    0 6px 16px rgba(0, 0, 0, 0.45);
}

/* Warm underline so the wordmark reads as burning rather than floating. */
.boot-wordmark::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff7a1a 0%, #ffd45e 50%, #ff7a1a 100%);
  box-shadow: 0 0 10px rgba(255, 122, 26, 0.75);
}

.boot-edition {
  font-size: clamp(12px, 2.4vw, 16px);
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.boot-loading {
  margin: 0;
  color: #fff;
  font-size: clamp(15px, 3vw, 20px);
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}

.boot-loading-word::after {
  content: '';
  animation: boot-dots 1.4s steps(1, end) infinite;
}

@keyframes boot-dots {
  0% {
    content: '';
  }
  20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%,
  100% {
    content: '...';
  }
}

.boot-marquee {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
  overflow: hidden;
  background: #000;
  border-top: 2px solid #9fd0ff;
}

/* The track holds the text twice, so sliding it half its own width lands
   copy two exactly where copy one started. No visible seam. */
.boot-marquee-text {
  position: absolute;
  bottom: 0;
  left: 0;
  width: max-content;
  color: #fff;
  font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  font-weight: bold;
  white-space: nowrap;
  line-height: 30px;
  animation: boot-scroll 7s linear infinite;
}

@keyframes boot-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (max-width: 560px) {
  .desktop {
    justify-content: flex-start;
    padding: 10px 6px;
  }

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

  .button.primary {
    width: 100%;
  }

  .row .button {
    flex: 1 1 140px;
  }

  .taskbar-item:not(.taskbar-clock) {
    display: none;
  }
}

@media (max-width: 380px) {
  .window-body {
    padding: 10px;
  }

  .title-bar {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .ticker-track {
    padding-left: 0;
    animation: none !important;
  }

  textarea::placeholder {
    border-right: 2px solid #6a6a6a;
  }

  .boot-logo {
    animation: none;
  }

  .boot-loading-word::after {
    content: '...';
  }

  .boot-marquee-text {
    animation: none;
  }
}
