:root {
  --bg: #0e0e0f;
  --panel: #151517;
  --panel-2: #1d1d20;
  --line: #2a2a2f;
  --text: #f6f6f2;
  --muted: #96969f;
  --accent: #33cc99;
  --danger: #ff6b6b;
  --success: #8ef0af;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

body { overflow-x: hidden; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,14,15,.96);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: baseline; gap: 14px; }
.brand-mark { font-weight: 900; letter-spacing: .14em; }
.brand-sub { color: var(--muted); font-size: 12px; letter-spacing: .16em; font-weight: 700; }
.version {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 6px;
  border: 1px solid #38383d;
  border-radius: 999px;
  color: #d7d7db;
  letter-spacing: .08em;
}

.top-actions { display: flex; gap: 10px; }

.button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 800;
}
.button.primary { background: var(--accent); color: #111; }
.button.secondary { background: #242429; color: #fff; border: 1px solid #323239; }
.button:hover { transform: translateY(-1px); }

.app-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 390px 1fr;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - 72px);
}

.panel-heading, .time-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .18em;
  font-weight: 900;
  margin-bottom: 6px;
}

h1, h2 { margin: 0; line-height: 1.15; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

.spec-chip {
  border: 1px solid #3a3a40;
  color: #b9b9c0;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.message {
  margin-top: 16px;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid #3a3a40;
}
.message.error { color: #ffd4d4; background: #29191b; border-color: #5a292d; }
.message.success { color: #d6ffe0; background: #15251b; border-color: #275739; }
.hidden { display: none !important; }

.upload-list { margin-top: 22px; display: grid; gap: 8px; }

.upload-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.upload-copy { min-width: 0; }
.upload-copy strong { display: block; font-size: 13px; }
.upload-copy span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-button {
  cursor: pointer;
  background: #f3f3ef;
  color: #111;
  font-size: 11px;
  font-weight: 900;
  padding: 8px 10px;
  border-radius: 8px;
}
.upload-button input { display: none; }

.tiny-action {
  border: 0;
  background: transparent;
  color: #a9a9b0;
  cursor: pointer;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 4px;
}
.tiny-action:hover { color: #fff; }

.time-panel, .info-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}


.crown-control {
  margin-top: 14px;
}

.wind-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid #3b3b42;
  border-radius: 12px;
  background: linear-gradient(180deg, #242428, #1a1a1d);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.wind-button:hover {
  border-color: #5c5c65;
}

.wind-button:active,
.wind-button.is-winding {
  transform: translateY(1px);
  border-color: var(--accent);
  background: linear-gradient(180deg, #2b2b27, #1e1e1a);
}

.wind-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #111;
  font-size: 20px;
  font-weight: 900;
}

.wind-button strong {
  display: block;
  font-size: 12px;
  line-height: 1.1;
}

.wind-button small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.wind-hint {
  margin-top: 6px;
  color: #777780;
  font-size: 9px;
  text-align: center;
}


.time-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: end;
  gap: 8px;
  margin-top: 14px;
}
.time-inputs label span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
}
.time-inputs input {
  width: 100%;
  background: #0f0f11;
  color: #fff;
  border: 1px solid #34343a;
  border-radius: 10px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  padding: 10px 4px;
}
.colon { color: #62626a; padding-bottom: 13px; font-weight: 900; }

.angle-readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.angle-readout div {
  background: #101012;
  border: 1px solid #29292e;
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.angle-readout span { color: var(--muted); font-size: 10px; }
.angle-readout strong { font-size: 11px; }

.info-panel p {
  margin: 8px 0 0;
  color: #aaaaaf;
  font-size: 11px;
  line-height: 1.55;
}

.workspace {
  min-width: 0;
  background:
    linear-gradient(45deg, rgba(255,255,255,.015) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.015) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.015) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.015) 75%),
    #101012;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
}

.workspace-toolbar, .workspace-footer {
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  background: rgba(18,18,20,.92);
}
.workspace-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 7px;
  box-shadow: 0 0 0 4px rgba(142,240,175,.08);
}

.zoom-controls { display: flex; align-items: center; gap: 7px; }
.zoom-controls button {
  border: 1px solid #333338;
  background: #1b1b1e;
  color: #ddd;
  border-radius: 7px;
  min-width: 30px;
  height: 28px;
  cursor: pointer;
}
.zoom-controls span { min-width: 44px; text-align: center; }

.stage-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 36px;
}

.canvas-scaler {
  width: 648px;
  height: 648px;
  position: relative;
  box-shadow: 0 28px 80px rgba(0,0,0,.38);
  background:
    linear-gradient(45deg, #e8e8e5 25%, transparent 25%),
    linear-gradient(-45deg, #e8e8e5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8e8e5 75%),
    linear-gradient(-45deg, transparent 75%, #e8e8e5 75%),
    #f4f4f1;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
}

#watchCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace { min-height: 700px; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .brand-sub { display: none; }
  .sidebar { padding: 16px; }
  .upload-card { grid-template-columns: 1fr auto; }
  .upload-card .tiny-action { grid-column: 2; }
  .stage-wrap { padding: 18px; }
}


.file-status {
  margin-top: 5px !important;
  font-size: 9px !important;
  color: var(--success) !important;
  font-weight: 800;
  letter-spacing: .02em;
}
.file-status.error {
  color: #ff8d8d !important;
}
.file-status.empty {
  color: #777780 !important;
  font-weight: 600;
}
.info-panel code {
  color: #e5e5e9;
  background: #0f0f11;
  border: 1px solid #2b2b30;
  border-radius: 5px;
  padding: 1px 4px;
  font-size: 10px;
}


.strap-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.strap-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.strap-option {
  min-width: 0;
  border: 1px solid #303036;
  background: #1b1b1e;
  color: #ddd;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.strap-option:hover {
  border-color: #505058;
}

.strap-option.active {
  border-color: var(--accent);
  background: #23231e;
}

.strap-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #101012;
  border: 1px solid #2b2b30;
  color: #8f8f97;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
}

.strap-option span:last-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 800;
}

.strap-status {
  margin-top: 8px;
  color: #7c7c84;
  font-size: 9px;
  text-align: center;
}


/* V0.5.3 — time controls above the watch preview */
.workspace-time-panel {
  margin: 0;
  padding: 14px 20px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(21,21,23,.96);
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(280px, 1.4fr) minmax(220px, 1fr);
  gap: 18px;
  align-items: center;
}

.workspace-time-panel .time-heading {
  align-items: center;
}

.workspace-time-panel .crown-control {
  margin-top: 0;
}

.workspace-time-panel .wind-hint {
  display: none;
}

.workspace-time-panel .time-inputs {
  margin-top: 0;
}

.workspace-time-panel .angle-readout {
  margin-top: 0;
}

@media (max-width: 1150px) {
  .workspace-time-panel {
    grid-template-columns: 1fr 1fr;
  }

  .workspace-time-panel .time-heading {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .workspace-time-panel {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .workspace-time-panel .time-heading {
    grid-column: auto;
  }
}


.brand-logo {
  display: block;
  width: auto;
  height: 30px;
  max-width: 180px;
  object-fit: contain;
}


.play-slider-row {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
}

.play-slider-row .wind-button {
  width: 100%;
}

.time-slider-wrap {
  min-width: 0;
}

.time-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.time-slider-head strong {
  color: #fff;
  font-size: 12px;
  letter-spacing: .04em;
}

.time-slider {
  width: 100%;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.time-slider:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (max-width: 850px) {
  .play-slider-row {
    grid-template-columns: 1fr;
  }
}


.case-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.case-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}
.case-option {
  min-height: 48px;
  border: 1px solid #303036;
  background: #1b1b1e;
  color: #ddd;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 9px;
  align-items: center;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.case-option:hover { border-color: #505058; }
.case-option.active {
  border-color: var(--accent);
  background: #23231e;
}
.case-swatch {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1px solid #4a4a50;
  flex: 0 0 25px;
}
.silver-swatch {
  background: linear-gradient(135deg,#777,#eee,#9a9a9a);
}
.black-swatch {
  background: linear-gradient(135deg,#050505,#444,#111);
}


.strap-thumb {
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(45deg, #1c1c1f 25%, transparent 25%),
    linear-gradient(-45deg, #1c1c1f 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1c1c1f 75%),
    linear-gradient(-45deg, transparent 75%, #1c1c1f 75%),
    #101012;
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.strap-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.strap-thumb-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #8f8f97;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
}


.speed-control {
  margin-bottom: 8px;
}

.time-control-divider {
  height: 1px;
  margin: 8px 0 10px;
  background: #2b2b30;
}
