/* ---------- DESIGN SYSTEM TOKENS ---------- */
:root {
  --text-size-delta: 0px;
  --ink: #EAF1F5;
  --ink-2: #F7FAFC;
  --ink-deep: #DCE7ED;
  --panel: #FFFFFF;
  --panel-glass: rgba(255, 255, 255, 0.88);
  --panel-line: rgba(16, 48, 72, 0.16);
  --panel-line-glow: rgba(242, 169, 59, 0.35);
  
  --paper: #ECE4D3;
  --paper-2: #E1D6BC;
  --paper-dark: #3A3225;
  
  --amber: #F2A93B;
  --amber-light: #FFD182;
  --amber-deep: #C9821F;
  --amber-surface: #F2A93B;
  --amber-glow: rgba(242, 169, 59, 0.22);
  
  --red: #DD4B30;
  --red-light: #FF7B63;
  --red-deep: #9C2E1C;
  --red-glow: rgba(221, 75, 48, 0.25);
  
  --teal: #3FA796;
  --teal-light: #76DFC5;
  --teal-deep: #1F6E62;
  --teal-glow: rgba(63, 167, 150, 0.25);
  
  --fog: #4D6476;
  --fog-light: #2D4659;
  --white: #102F47;
  --board-bg: #163F5F;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --glass-border: 1px solid rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--ink-deep);
  color: var(--white);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[data-text-size="small"] {
  --text-size-delta: -1px;
}

html[data-text-size="normal"] {
  --text-size-delta: 0px;
}

html[data-text-size="large"] {
  --text-size-delta: 2px;
}

html[data-theme="dark"] {
  --ink: #0A1E30;
  --ink-2: #0F2A42;
  --ink-deep: #061421;
  --panel: #123A5A;
  --panel-glass: rgba(18, 58, 90, 0.82);
  --panel-line: rgba(255, 255, 255, 0.20);
  --fog: #D0DCE5;
  --fog-light: #F1F5F8;
  --white: #F7F9FA;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(180deg, #F5F9FB 0%, #DCE7ED 100%);
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #163E63 0%, #061421 100%);
}

.app-viewport {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 45px rgba(21, 52, 73, 0.24);
  background-image: linear-gradient(180deg, #F7FAFC 0%, #EAF1F5 48%, #E4EDF2 100%);
}

html[data-theme="dark"] .app-viewport {
  background-image: linear-gradient(180deg, #0F2A42 0%, #0A1E30 48%, #071827 100%);
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 250, 252, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--panel-line);
}

html[data-theme="dark"] header {
  background: rgba(10, 30, 48, 0.94);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: 'Pretendard', sans-serif;
  font-weight: 800;
  font-size: calc(22px + var(--text-size-delta));
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--white);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand span {
  color: var(--amber);
}

.status-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: calc(10.5px + var(--text-size-delta));
  color: var(--teal-light);
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--teal-deep);
  background: rgba(31, 110, 98, 0.2);
  padding: 4px 9px;
  border-radius: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal-light);
  box-shadow: 0 0 8px var(--teal-light);
  animation: pulse-glow 2s infinite;
}

.sub-row {
  margin-top: 6px;
  font-size: calc(11.5px + var(--text-size-delta));
  color: var(--fog);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#subRow {
  min-width: 0;
  padding-right: 8px;
}

.display-controls-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 7px;
}

.display-control-label {
  color: var(--fog);
  font-size: calc(10px + var(--text-size-delta));
  font-weight: 700;
}

.text-size-controls {
  display: inline-flex;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: #FFFFFF;
}

.theme-mode-controls {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: #FFFFFF;
}

html[data-theme="dark"] .text-size-controls,
html[data-theme="dark"] .theme-mode-controls {
  background: rgba(6, 20, 33, 0.78);
}

.text-size-controls button {
  min-width: 30px;
  border: 0;
  border-right: 1px solid var(--panel-line);
  background: transparent;
  color: var(--fog-light);
  padding: 5px 7px;
  font: 700 11px/1 'Pretendard', sans-serif;
  cursor: pointer;
}

.theme-mode-controls button {
  border: 0;
  border-right: 1px solid var(--panel-line);
  background: transparent;
  color: var(--fog-light);
  padding: 5px 8px;
  font: 700 10.5px/1 'Pretendard', sans-serif;
  cursor: pointer;
}

.theme-mode-controls button:last-child {
  border-right: 0;
}

.theme-mode-controls button.active {
  background: var(--amber-surface);
  color: #1E1202;
}

.text-size-controls button:last-child {
  border-right: 0;
}

.text-size-controls button.active {
  background: var(--amber-surface);
  color: #1e1202;
}

.sub-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: calc(10px + var(--text-size-delta));
  color: var(--amber);
}

/* Main Body Container */
main {
  flex: 1;
  padding: 16px 16px 110px;
  overflow-x: hidden;
}

/* Section Title & Description */
.section-title {
  font-family: 'Pretendard', sans-serif;
  font-weight: 700;
  font-size: calc(22px + var(--text-size-delta));
  letter-spacing: 0.5px;
  margin: 4px 0 4px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  color: var(--amber);
}

.section-desc {
  font-size: calc(13.5px + var(--text-size-delta));
  color: var(--fog);
  margin: 0 0 16px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #B8C7D3;
  opacity: 1;
}

/* Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  font-family: 'Pretendard', sans-serif;
  font-size: calc(13px + var(--text-size-delta));
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--panel-glass);
  backdrop-filter: blur(4px);
  border: 1px solid var(--panel-line);
  color: var(--fog);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip:hover {
  border-color: var(--amber);
  color: var(--white);
  transform: translateY(-1px);
}

.chip.on {
  background: var(--amber-surface);
  color: #1c1102;
  border-color: var(--amber-surface);
  font-weight: 700;
  box-shadow: none;
}

/* Button & Controls */
.btn-primary {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  background: var(--amber-surface);
  color: #1e1202;
  font-family: 'Pretendard', sans-serif;
  font-weight: 700;
  font-size: calc(14.5px + var(--text-size-delta));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(117, 64, 8, 0.18);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--white);
  font-family: 'Pretendard', sans-serif;
  font-weight: 600;
  font-size: calc(13.5px + var(--text-size-delta));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--amber);
  color: var(--amber);
}
