/* General Styles */
:root {
  --page: #dedede;
  --header: #c8c8c8;
  --surface: #ffffff;
  --surface-alt: #f3f3f1;
  --text: #161616;
  --muted: #686868;
  --line: #b8b8b8;
  --blue: #1565c0;
  --blue-soft: #e7f1ff;
  --success: #267a4a;
  --warning: #9a6700;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.10);
}

html, body {
  min-height: 100%;
  width: 100%;
  background-color: var(--page);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  transition: background-color 0.5s ease, color 0.5s ease;
}

header {
  width: 100%;
  height: 100px;
  padding: 10px 0;
  background-color: var(--header);
  position: fixed;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.5s ease, color 0.5s ease;
}
.header-divider {
  width: 100%;
  height: 2px;
  background-color: #7d7d7d;
  position: fixed;
  top: 100px;
  z-index: 9;
}
.link {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
}
.link h5 { margin: 0; white-space: nowrap; }

.container {
  width: min(1180px, calc(100% - 36px));
  max-width: 1180px;
  display: flex;
  transition: background-color 0.5s ease, color 0.5s ease;
}

#darkModeToggle {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
}

main {
  padding-top: 120px;
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.title-block { margin-bottom: 28px; }
.title-block h3 { margin: 7px 0 8px; font-weight: 700; letter-spacing: -1px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: 2.4px; }
.subtitle { max-width: 680px; margin: 0 auto; color: var(--muted); font-size: 16px; line-height: 1.65; }

main .content {
  width: 100%;
  max-width: none;
  padding: 22px;
  background-color: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: background-color 0.5s ease, color 0.5s ease;
}

.workspace { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(330px, .88fr); gap: 20px; align-items: start; }
.results-panel { display: grid; gap: 16px; }
.panel { background: var(--surface-alt); border: 1px solid rgba(0,0,0,.10); border-radius: 12px; padding: 20px; }
.panel-heading, .details-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.panel-heading h4, .details-heading h5 { margin: 0; font-size: 18px; font-weight: 700; }
.step-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 10px; }
.color-chip, .status-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 10px; background: var(--surface); border: 1px solid rgba(0,0,0,.12); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.color-chip span { width: 11px; height: 11px; border-radius: 50%; background: #000; }
.status-pill span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(154,103,0,.12); }
.status-pill.loading { color: var(--warning); }
.status-pill.ready { color: var(--success); }
.status-pill.error { color: #a33a32; }

.canvas-shell { position: relative; width: 100%; aspect-ratio: 1; max-height: 520px; border: 1px solid #a8a8a8; border-radius: 8px; background: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.03); touch-action: none; }
#drawingCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.canvas-guide { pointer-events: none; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); color: #c5c5c5; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; transition: opacity .2s ease; }
.canvas-shell.has-ink .canvas-guide { opacity: 0; }
.canvas-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tool-button { height: 42px; border: 1px solid rgba(0,0,0,.16); border-radius: 8px; color: var(--text); background: var(--surface); text-transform: none; font-weight: 500; line-height: 40px; cursor: pointer; }
.tool-button:hover, .tool-button:focus-visible { background: var(--blue-soft); color: var(--blue); }
.file-button { display: inline-flex; align-items: center; }

.prediction-card { background: var(--text); color: #fff; border-color: var(--text); }
.prediction-card .step-number { background: #fff; color: #111; }
.prediction-card .status-pill { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.08); }
.prediction-main { min-height: 142px; display: flex; align-items: center; gap: 18px; padding: 15px 0 20px; }
.prediction-icon { flex: 0 0 auto; display: grid; place-items: center; width: 74px; height: 74px; border: 2px solid rgba(255,255,255,.75); border-radius: 18px; font: 500 32px 'Orbitron', sans-serif; }
.prediction-label { margin: 0 0 5px; color: #a9a9a9; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
#topPrediction { margin: 0; color: #fff; font-size: clamp(22px, 3vw, 32px); text-transform: capitalize; }
.confidence { margin: 6px 0 0; color: #d0d0d0; }
.input-preview-row { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.18); padding-top: 15px; }
.input-preview-row p { margin: 0; color: #aaa; font-size: 12px; }
.input-preview-row .mini-label { color: #fff; font-size: 9px; margin-bottom: 4px; letter-spacing: .14em; }
#modelInputCanvas { width: 60px; height: 60px; image-rendering: pixelated; background: #fff; border: 1px solid #707070; }

.details-card { padding-bottom: 12px; }
.details-heading { margin-bottom: 12px; }
.details-heading span { color: var(--muted); font-size: 12px; }
.prediction-list { display: grid; gap: 9px; }
.prediction-row { display: grid; grid-template-columns: minmax(110px, 1fr) 1.7fr 50px; align-items: center; gap: 10px; font-size: 12px; }
.prediction-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.probability-track { height: 7px; background: #d2d2d0; border-radius: 99px; overflow: hidden; }
.probability-fill { height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .18s ease; }
.prediction-percent { font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.prediction-row.winner .prediction-name { font-weight: 700; color: var(--blue); }
.prediction-row.winner .probability-fill { background: var(--text); }

.model-notice { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 11px 13px; border-radius: 8px; background: var(--blue-soft); color: #274c77; font-size: 13px; }
.model-notice i { font-size: 19px; }
.version { margin: 0; font-size: 14px; color: var(--muted); }
.darkLightText { color: #646464; }

/* Common & Simple Styles */
.orbitron { font-family: 'Orbitron', sans-serif; }
.press-start { font-family: 'Press Start 2P', cursive; }
.hidden { display: none; }
.center { align-self: center; text-align: center; align-items: center; vertical-align: middle; }
.rounded { border-radius: 20px; }
.scrollable { overflow-y: auto; }
.divider { width: 100%; height: 2px; background-color: #7d7d7d; margin: 30px 0 18px; }

/* Dark Mode Styles */
html.dark-mode, body.dark-mode { --page: #1e1e1e; --header: #282828; --surface: #323232; --surface-alt: #282828; --text: #f5f5f5; --muted: #b8b8b8; --line: #555; --blue-soft: #1b3654; background-color: var(--page); color: white; }
header.dark-mode { background-color: var(--header); color: white; }
main .content.dark-mode { background-color: var(--surface); color: white; }
.header-divider.dark-mode, .divider.dark-mode { background-color: #afafaf; }
.dark-mode .panel { border-color: rgba(255,255,255,.12); }
.dark-mode .prediction-card { background: #111; }
.dark-mode .step-number { background: #f5f5f5; color: #111; }
.dark-mode .prediction-card .step-number { background: #fff; color: #111; }
.dark-mode .tool-button, .dark-mode .color-chip { border-color: rgba(255,255,255,.18); }
.dark-mode .probability-track { background: #4b4b4b; }
.dark-mode .prediction-row.winner .probability-fill { background: #fff; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .canvas-shell { max-height: none; }
}

@media (max-width: 600px) {
  header { height: 86px; }
  .header-divider { top: 86px; }
  .link { left: 14px; transform: none; }
  .link h5 { font-size: 15px; }
  #darkModeToggle { top: 50px; }
  main { padding-top: 102px; }
  .container { width: min(100% - 20px, 1180px); }
  main .content { padding: 12px; }
  .panel { padding: 14px; }
  .title-block h3 { font-size: 28px; }
  .subtitle { font-size: 14px; }
  .panel-heading { align-items: flex-start; }
  .prediction-row { grid-template-columns: 110px 1fr 45px; gap: 7px; }
}
