:root {
  --bar-h: 48px; --row-h: 56px; --copy-w: 64px; --font: 16px;
  --orange: #f97316; --green: #22c55e; --red: #ef4444;
  --bg: #ffffff; --fg: #1f2937; --dim: #9ca3af; --line: #e5e7eb; --btn: #f3f4f6; --bar: #fff7ed;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111827; --fg: #f3f4f6; --dim: #6b7280; --line: #374151; --btn: #1f2937; --bar: #1f2937; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; background: var(--bg); color: var(--fg);
  font-family: -apple-system, "Noto Sans KR", "Roboto", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100dvh; }
#bar { height: var(--bar-h); flex: none; display: flex; justify-content: space-between; align-items: stretch;
  background: var(--bar); border-bottom: 1px solid var(--line); }
#bar button { background: none; border: 0; padding: 0 16px; font-size: 15px; }
#btnRefresh.offline { color: var(--red); font-weight: 700; }

#list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.empty-msg { padding: 24px; text-align: center; color: var(--dim); }

.row { position: relative; display: flex; align-items: stretch; height: var(--row-h); overflow: hidden;
  border-bottom: 1px solid var(--line);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.row .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(249, 115, 22, .55);
  pointer-events: none; z-index: 0; }
.row .label { position: relative; z-index: 1; flex: 1; min-width: 0; align-self: center; padding: 0 12px;
  font-size: var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .label.blank { color: var(--dim); }
.row button { position: relative; z-index: 1; border: 0; border-left: 1px solid var(--line); background: var(--btn); flex: none; }
.row .copy { width: var(--copy-w); display: flex; align-items: center; justify-content: center; }
.row .copy svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row .copy .ic-check { display: none; }
.row .copy.flash .ic-check { display: block; }
.row .copy.flash .ic-copy { display: none; }
.row .copy.done { background: var(--green); color: #fff; }
.row .copy.blank-item { opacity: .4; }
.row .undo { padding: 0 12px; font-size: 14px; background: var(--orange); color: #fff; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 88vw; padding: 10px 16px; border-radius: 20px; background: rgba(31, 41, 55, .94); color: #fff;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; text-align: center; }
#toast.show { opacity: 1; }

#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 20; }
.login-box { width: min(340px, 86vw); display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0 0 8px; text-align: center; color: var(--orange); }
.login-box input { padding: 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.login-box button { padding: 12px; font-size: 16px; border: 0; border-radius: 8px; background: var(--orange); color: #fff; }
.login-box button:disabled { opacity: .6; }
#loginMsg { min-height: 1.4em; margin: 0; text-align: center; color: var(--red); font-size: 14px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; z-index: 30; }
.dialog { width: min(420px, 92vw); max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 14px; padding: 18px; }
.dialog h2 { margin: 0 0 12px; font-size: 18px; }
.dialog label { display: block; margin: 12px 0; font-size: 14px; }
.dialog label b { float: right; font-weight: 600; color: var(--orange); }
.dialog input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--orange); }
.dialog select { width: 100%; margin-top: 6px; padding: 8px; font-size: 15px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; }
.btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn-row button { flex: 1; padding: 11px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--btn); font-size: 14px; }
.btn-row .danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-row .primary { background: var(--orange); border-color: var(--orange); color: #fff; }
