:root {
  --bg: #0f1117;
  --panel: #1a1d27;
  --panel-2: #232735;
  --border: #2d3242;
  --text: #e7e9ee;
  --muted: #8b90a0;
  --accent: #6c8cff;
  --accent-2: #4f6ef7;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 50% -10%, #1b2030 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
    "Apple SD Gothic Neo", Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 4px;
}
.brand .dot { font-size: 24px; }
.brand .spacer { flex: 1; }

.lang-switch { display: inline-flex; gap: 4px; }
.lang-switch button {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 8px;
  background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: pointer;
}
.lang-switch button.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.tagline {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px 34px;
  letter-spacing: .2px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 14px; }

/* 폼 */
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--accent); }

/* 브라우저 자동완성 시 흰 배경/검은 글씨 덮어쓰기 방지 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-2) inset;
  box-shadow: 0 0 0 1000px var(--panel-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s, background .15s, opacity .15s;
  user-select: none;
}
.btn:hover { background: #2b3142; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); }
.btn.primary:hover { background: var(--accent); }
.btn.green { background: var(--green); border-color: var(--green); color: #06281d; }
.btn.red { background: var(--red); border-color: var(--red); color: #2c0b0b; }
.btn.ghost { background: transparent; }
.btn.lg { padding: 16px 26px; font-size: 17px; }
.btn.block { width: 100%; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.error {
  color: var(--red);
  font-size: 14px;
  margin-top: 8px;
  min-height: 18px;
}
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; text-align: center; padding: 10px; border-radius: 10px;
  cursor: pointer; color: var(--muted); border: 1px solid transparent;
}
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }

.hidden { display: none !important; }

/* 대시보드 타이머 목록 */
.timer-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.timer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer;
}
.timer-item:hover { border-color: var(--accent); }
.timer-item .name { font-weight: 600; }

/* ── 타이머 페이지 ── */
.topbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
}
.topbar .who { margin-left: auto; color: var(--muted); font-size: 14px; }

.timer-display {
  text-align: center;
  padding: 40px 20px 30px;
}
.timer-name { font-size: 18px; color: var(--muted); margin-bottom: 10px; }
.clock {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  font-size: clamp(56px, 14vw, 120px);
  letter-spacing: 2px;
  line-height: 1;
}
.clock.finished { color: var(--amber); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
.mode-badge {
  display: inline-block; margin-top: 14px; padding: 5px 12px;
  border-radius: 999px; font-size: 13px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--muted);
}

.controls { display: flex; gap: 12px; justify-content: center; margin: 26px 0 8px; }

.phase-now {
  margin-top: 12px; font-size: 18px; font-weight: 700; color: var(--accent);
}
.phase-strip {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 0;
}
.phase-chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.phase-chip.done { opacity: .45; }
.phase-chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

.ai-box {
  margin-top: 22px; padding: 18px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(108,140,255,.08), rgba(79,110,247,.05));
  border: 1px solid var(--border);
}
.ai-box.locked { opacity: .5; pointer-events: none; }
.ai-box h2 { margin-bottom: 6px; }
.ai-preview {
  margin-top: 14px; padding: 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.ai-preview .plan-name { font-weight: 700; margin-bottom: 4px; }
.ai-preview .plan-total { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.settings {
  margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border);
}
.settings.locked { opacity: .5; pointer-events: none; }
.time-inputs { display: flex; align-items: flex-end; gap: 8px; }
.time-inputs .field { margin-bottom: 0; width: 90px; }
.time-inputs .colon { font-size: 22px; padding-bottom: 10px; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button {
  padding: 10px 16px; background: var(--panel-2); color: var(--muted);
  border: none; cursor: pointer; font-size: 14px; font-weight: 600;
}
.seg button.active { background: var(--accent-2); color: #fff; }

/* 접속자 목록 */
.presence { margin-top: 26px; }
.presence h2 { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
.people { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px;
}
.person .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.person .pname { font-weight: 600; }
.person .tag {
  font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 600;
}
.tag.owner { background: rgba(251,191,36,.15); color: var(--amber); border: 1px solid rgba(251,191,36,.3); }
.tag.ctrl { background: rgba(108,140,255,.15); color: var(--accent); border: 1px solid rgba(108,140,255,.3); }
.tag.me { background: rgba(52,211,153,.15); color: var(--green); border: 1px solid rgba(52,211,153,.3); }
.tag.guest { background: rgba(139,144,160,.15); color: var(--muted); border: 1px solid rgba(139,144,160,.3); }
.person .actions { margin-left: auto; display: flex; gap: 6px; }
.person .actions .btn { padding: 6px 12px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
