:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f5f7f4;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(18px, 3vw, 40px);
  align-items: start;
  justify-items: center;
  background: var(--app-bg);
  color: var(--app-fg);
  transition:
    background 180ms ease,
    color 180ms ease;
}

.theme-dark {
  --app-bg: #f5f7f4;
  --app-fg: #141a18;
  --muted-fg: #68736f;
  --screen-bg: #0f1315;
  --screen-border: #151a1d;
  --screen-shadow: 0 22px 58px rgba(16, 24, 22, 0.18);
  --toolbar-bg: #171c1f;
  --toolbar-border: rgba(255, 255, 255, 0.08);
  --terminal-title: #c6d0d2;
  --overlay-bg: rgba(8, 12, 14, 0.18);
  --overlay-button-bg: rgba(13, 17, 19, 0.74);
  --code-bg: rgba(18, 27, 25, 0.08);
  --code-fg: #1d2926;
  --control-fg: #dce4ea;
  --controls-gradient: linear-gradient(
    180deg,
    rgba(8, 12, 14, 0),
    rgba(8, 12, 14, 0.72) 28%,
    rgba(8, 12, 14, 0.92)
  );
  --button-hover-bg: rgba(255, 255, 255, 0.1);
  --accent: #56d6bd;
  --track-rest: rgba(255, 255, 255, 0.24);
  --thumb: #effffc;
}

.theme-light {
  --app-bg: #f3f6f2;
  --app-fg: #151c19;
  --muted-fg: #66736d;
  --screen-bg: #f8fbf8;
  --screen-border: #cfd8d4;
  --screen-shadow: 0 22px 58px rgba(22, 33, 29, 0.14);
  --toolbar-bg: #e9efec;
  --toolbar-border: rgba(29, 41, 38, 0.1);
  --terminal-title: #53615c;
  --overlay-bg: rgba(242, 247, 244, 0.34);
  --overlay-button-bg: rgba(247, 251, 248, 0.86);
  --code-bg: rgba(22, 34, 30, 0.08);
  --code-fg: #1d2926;
  --control-fg: #1d2926;
  --controls-gradient: linear-gradient(
    180deg,
    rgba(248, 251, 248, 0),
    rgba(248, 251, 248, 0.78) 28%,
    rgba(248, 251, 248, 0.96)
  );
  --button-hover-bg: rgba(17, 35, 31, 0.08);
  --accent: #268b7a;
  --track-rest: rgba(25, 43, 38, 0.2);
  --thumb: #f8fbf8;
}

.player-shell {
  display: grid;
  gap: 16px;
  width: max-content;
}

.player-topline {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  min-width: 0;
  padding: 0 2px;
}

.player-topline h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-topline p {
  margin: 5px 0 0;
  color: var(--muted-fg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.demo-intro {
  display: grid;
  gap: 8px;
  max-width: 760px;
  padding: 0 2px;
  color: var(--muted-fg);
  font-size: 14px;
  line-height: 1.5;
}

.demo-intro p {
  margin: 0;
}

.usage-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 21px;
}

.usage-list li {
  padding-left: 2px;
}

.inline-code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.94em;
  white-space: nowrap;
}

.screen {
  display: inline-grid;
  grid-template-rows: 40px auto;
  width: max-content;
  min-width: 0;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--screen-border);
  border-radius: 12px;
  background: var(--screen-bg);
  box-shadow:
    var(--screen-shadow),
    0 1px 0 rgba(255, 255, 255, 0.5);
}

.terminal-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--toolbar-border);
  background: var(--toolbar-bg);
}

.traffic {
  display: flex;
  gap: 8px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot-red {
  background: #ec6a5f;
}

.dot-yellow {
  background: #f4bf4f;
}

.dot-green {
  background: #61c554;
}

.terminal-title {
  overflow: hidden;
  color: var(--terminal-title);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-host {
  min-height: 0;
  overflow: visible;
  padding: 14px 14px 88px;
}

.terminal-host .xterm {
  width: max-content;
  height: auto;
}

.play-overlay {
  display: grid;
  position: absolute;
  inset: 40px 0 0;
  z-index: 2;
  width: 100%;
  border: 0;
  place-items: center;
  background: var(--overlay-bg);
  cursor: pointer;
}

.overlay-play-button {
  display: grid;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  place-items: center;
  background: var(--overlay-button-bg);
  color: var(--control-fg);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.overlay-play-button .icon {
  width: 42px;
  height: 42px;
  margin-left: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.error-line {
  padding: 10px 12px;
  border: 1px solid #e6b7a6;
  border-radius: 10px;
  background: #fff3ee;
  color: #8b321e;
  font-size: 13px;
}

.player-controls {
  display: grid;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  gap: 7px;
  padding: 13px 14px 12px;
  border: 0;
  border-radius: 0;
  background: var(--controls-gradient);
  color: var(--control-fg);
}

.scrubber {
  width: 100%;
  height: 22px;
  min-width: 120px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.scrubber::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0 var(--progress),
    var(--track-rest) var(--progress) 100%
  );
}

.scrubber::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  appearance: none;
  background: var(--thumb);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.scrubber::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--track-rest);
}

.scrubber::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--thumb);
}

.control-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.control-row::-webkit-scrollbar {
  display: none;
}

.timecode {
  color: var(--control-fg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.control-spacer {
  flex: 1;
  min-width: 12px;
}

.player-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--control-fg);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.player-button:hover {
  background: var(--button-hover-bg);
}

.player-button.primary {
  color: var(--control-fg);
}

.icon-button {
  display: grid;
  width: 36px;
  min-width: 36px;
  padding: 0;
  place-items: center;
}

.text-button {
  min-width: 42px;
}

.theme-button {
  min-width: 70px;
}

.speed-button {
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}

.button-content,
.button-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  background: currentColor;
  mask: var(--icon-url) center / contain no-repeat;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
}

.icon-play {
  --icon-url: url("https://cdn.jsdelivr.net/npm/lucide-static@1.14.0/icons/play.svg");
}

.icon-pause {
  --icon-url: url("https://cdn.jsdelivr.net/npm/lucide-static@1.14.0/icons/pause.svg");
}

.icon-upload {
  --icon-url: url("https://cdn.jsdelivr.net/npm/lucide-static@1.14.0/icons/upload.svg");
}

.icon-sun {
  --icon-url: url("https://cdn.jsdelivr.net/npm/lucide-static@1.14.0/icons/sun.svg");
}

.icon-moon {
  --icon-url: url("https://cdn.jsdelivr.net/npm/lucide-static@1.14.0/icons/moon.svg");
}

.file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-button {
  position: relative;
  min-width: 98px;
  overflow: hidden;
}

.upload-button .button-content {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .screen {
    grid-template-rows: 40px auto;
  }

  .player-topline {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .scrubber {
    min-width: 0;
  }
}
