:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef3fb;
  --text: #151922;
  --muted: #667089;
  --line: #d7deea;
  --accent: #7c3aed;
  --accent-soft: rgba(124,58,237,.10);
  --shadow: 0 20px 50px rgba(17,24,39,.08);
}
* { box-sizing: border-box; }
body { margin-top: 70px; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans KR",sans-serif; }
button,select { font: inherit; cursor: pointer; }
h2,h3,p { margin-top: 0; }

/* App */
.scr-app { max-width: 100%; padding: 24px 0 60px; }

/* Header */
.scr-header {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 28px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
}
.scr-title { margin: 0 0 8px; font-size: 34px; line-height: 1.15; }
.scr-sub { margin: 0; color: var(--muted); }
.scr-header-acts { display: flex; gap: 10px; flex-shrink: 0; justify-content: flex-end; padding: 8px 0 4px; }

/* Buttons */
.scr-btn {
  appearance: none; border-radius: 14px; padding: 12px 18px;
  font-weight: 700; font-size: 14px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); white-space: nowrap;
}
.scr-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.scr-ghost { background: var(--panel-2); color: var(--text); }
.scr-btn:hover { opacity: .88; }

/* Strip */
.scr-strip {
  display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 12px;
  margin-top: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow); padding: 16px;
}
.scr-metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.scr-metric span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.scr-metric strong { font-size: 20px; }

/* Tabs */
.scr-tabs {
  display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; margin-top: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.scr-tab {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 12px 18px; border-radius: 14px; font-weight: 700;
}
.scr-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Main */
.scr-main { margin-top: 16px; display: grid; gap: 16px; }
.scr-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 24px; }
.scr-hidden { display: none; }

/* Panel head */
.scr-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.scr-panel-head h2 { margin: 0 0 6px; font-size: 22px; }
.scr-panel-head p { margin: 0; color: var(--muted); }
.scr-panel-acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.scr-inline-stat { font-weight: 700; white-space: nowrap; }

/* Palette */
.scr-palette-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; font-weight: 700; flex-wrap: wrap; }
.scr-palette { display: flex; gap: 10px; flex-wrap: wrap; }
.scr-swatch {
  width: 44px; height: 44px; border-radius: 12px;
  border: 3px solid transparent; transition: transform .15s, box-shadow .15s;
}
.scr-swatch:hover { transform: scale(1.12); }
.scr-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Preview */
.scr-preview-wrap { position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--line); }
.scr-preview { height: 220px; transition: background .2s; background: #ff0000; }
.scr-preview-meta {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; gap: 14px; background: rgba(0,0,0,.55); color: #fff;
  padding: 7px 14px; border-radius: 10px; font-size: 14px; font-weight: 700;
  pointer-events: none;
}

/* Note */
.scr-note { padding: 14px 18px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.7; }

/* Canvas */
.scr-canvas-wrap {
  position: relative; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2); min-height: 340px; margin-bottom: 16px;
}
.scr-canvas-dark { background: #101520; }
.scr-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.scr-canvas-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: var(--muted); text-align: center; pointer-events: none; font-size: 16px; width: 80%;
}
.scr-canvas-msg--light { color: rgba(255,255,255,.6); }

/* Stat row */
.scr-stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.scr-stat-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.scr-stat-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.scr-stat-card strong { font-size: 24px; }

/* Info grid */
.scr-info-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.scr-info-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.scr-info-card h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.scr-info-card strong { font-size: 22px; display: block; margin-bottom: 4px; }
.scr-info-card small { color: var(--muted); font-size: 12px; }

/* Fullscreen overlay */
.scr-overlay {
  position: fixed; inset: 0; z-index: 9999; display: none;
  background: #ff0000; cursor: pointer;
}
.scr-overlay.scr-ov-active { display: block; }
.scr-touch-overlay { background: #101520 !important; cursor: default; }
.scr-overlay-close {
  position: fixed; top: 20px; left: 20px; z-index: 10001;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  border-radius: 50%; width: 46px; height: 46px; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.scr-overlay-badge {
  position: fixed; top: 20px; right: 20px; z-index: 10001;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 10px 18px; border-radius: 14px;
  font-weight: 700; font-size: 18px; display: flex; gap: 16px;
  pointer-events: none;
}
.scr-overlay-hint {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 10001;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 10px 22px; border-radius: 999px; font-size: 14px;
  pointer-events: none; white-space: nowrap;
}
.scr-touch-overlay canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Responsive */
@media (max-width: 980px) {
  .scr-strip { grid-template-columns: repeat(3,1fr); }
  .scr-stat-row, .scr-info-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .scr-strip { grid-template-columns: repeat(2,1fr); }
  .scr-stat-row, .scr-info-grid { grid-template-columns: 1fr; }
  .scr-panel-head { flex-direction: column; }
  .scr-title { font-size: 26px; }
  .scr-overlay-hint { white-space: normal; text-align: center; width: 90%; }
}
