:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --success: #0f9f6e;
  --danger: #e11d48;
  --warning: #d97706;
  --shadow: 0 16px 40px rgba(15, 23, 42, .07);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar: 92px;
  --header: 68px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0b1120;
  --panel: #111827;
  --panel-soft: #182236;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: #263449;
  --primary: #60a5fa;
  --primary-2: #3b82f6;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --shadow: 0 18px 44px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 9999; background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--header); z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px 0 20px;
  background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px);
}
:root[data-theme='dark'] .topbar { background: rgba(17,24,39,.88); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(145deg, var(--primary), #8b5cf6); color: #fff; box-shadow: 0 8px 20px rgba(37,99,235,.25); }
.brand small { display: block; font-size: 11px; line-height: 1; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.mobile-menu { display: none; }

.sidebar {
  position: fixed; z-index: 55; left: 0; top: var(--header); bottom: 0; width: var(--sidebar);
  background: #101827; color: #cbd5e1; padding: 14px 10px; border-right: 1px solid rgba(255,255,255,.04);
}
.nav-list { display: grid; gap: 7px; }
.nav-item { position: relative; display: grid; place-items: center; gap: 4px; min-height: 67px; padding: 9px 4px; border-radius: 14px; font-size: 12px; transition: .2s ease; }
.nav-item .nav-ico { font-size: 22px; line-height: 1; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.is-active { color: #fff; background: linear-gradient(145deg, rgba(37,99,235,.95), rgba(99,102,241,.9)); box-shadow: 0 8px 20px rgba(37,99,235,.2); }
.sidebar-backdrop { display: none; }

.app { margin-left: var(--sidebar); padding-top: var(--header); min-height: 100vh; }
.main { max-width: 1420px; margin: 0 auto; padding: 28px; }
.hero {
  position: relative; overflow: hidden; min-height: 420px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); padding: 40px 24px;
}
.hero::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(59,130,246,.11), transparent 66%); top: -260px; right: -120px; pointer-events: none; }
.hero-content { position: relative; text-align: center; width: min(920px, 100%); }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .16em; color: var(--primary); }
.hero-title { margin: 0; font-size: clamp(24px, 3vw, 42px); letter-spacing: -.04em; }
.hero-desc { max-width: 760px; margin: 12px auto 0; color: var(--muted); }
.live-clock { margin-top: 26px; font-variant-numeric: tabular-nums; font-size: clamp(54px, 9vw, 122px); line-height: 1; font-weight: 750; letter-spacing: -.055em; }
.live-date { margin-top: 14px; font-size: clamp(16px, 2vw, 23px); color: var(--muted); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.section { margin-top: 22px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); padding: 24px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card h2, .card h3 { margin: 0; letter-spacing: -.025em; }
.card h2 { font-size: 22px; }
.card h3 { font-size: 17px; }
.subtle { color: var(--muted); }
.note { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--panel-soft); color: var(--muted); font-size: 14px; }
.note strong { color: var(--text); }

.btn { min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.22); }
.btn-primary:hover { background: var(--primary-2); }
.btn-secondary { background: var(--panel); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.button-row.center { justify-content: center; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; }
.preset-btn { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); color: var(--text); font-weight: 700; }
.preset-btn:hover { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--panel)); }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.field { display: grid; gap: 7px; }
.field label, .field .label { font-size: 13px; font-weight: 750; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 10px 12px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 13px; font-weight: 700; }
.check-chip input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); color: var(--primary); }

.tool-display { text-align: center; padding: 22px; }
.tool-number { font-variant-numeric: tabular-nums; font-size: clamp(52px, 9vw, 112px); line-height: 1; font-weight: 760; letter-spacing: -.055em; }
.tool-caption { margin-top: 12px; color: var(--muted); }

.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.list-main { min-width: 0; }
.list-title { font-weight: 800; }
.list-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 10%, var(--panel)); color: var(--primary); font-size: 12px; font-weight: 800; }
.badge.success { background: color-mix(in srgb, var(--success) 12%, var(--panel)); color: var(--success); }
.badge.danger { background: color-mix(in srgb, var(--danger) 12%, var(--panel)); color: var(--danger); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
th { background: var(--panel-soft); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }

.content-section { margin-top: 22px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.content-section h2 { margin-top: 0; font-size: 25px; letter-spacing: -.03em; }
.content-section h3 { margin: 26px 0 8px; font-size: 18px; }
.content-section p, .content-section li { color: var(--muted); }
.content-section strong { color: var(--text); }
.faq details { border-top: 1px solid var(--line); padding: 16px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq details p { margin-bottom: 0; }

.footer { margin-top: 32px; padding: 30px 28px 44px; color: var(--muted); font-size: 13px; }
.footer-inner { max-width: 1420px; margin: 0 auto; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }

.toast-wrap { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { opacity: 0; transform: translateY(10px); transition: .22s ease; min-width: 240px; max-width: 380px; padding: 13px 16px; border-radius: 12px; background: var(--text); color: var(--panel); box-shadow: var(--shadow); font-size: 14px; }
.toast.show { opacity: 1; transform: translateY(0); }
.ring-overlay { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2,6,23,.72); backdrop-filter: blur(10px); }
.ring-card { width: min(480px, 100%); text-align: center; border-radius: 28px; background: var(--panel); padding: 38px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.ring-card h2 { margin: 0 0 8px; font-size: 30px; }
.ring-card p { color: var(--muted); }
.ring-pulse { font-size: 56px; animation: ring 1s infinite ease-in-out; }
@keyframes ring { 0%,100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .mobile-menu { display: inline-grid; }
  .sidebar { transform: translateX(-110%); width: 240px; transition: .2s ease; }
  .sidebar .nav-item { grid-template-columns: 34px 1fr; justify-items: start; min-height: 50px; padding: 8px 12px; font-size: 14px; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; z-index: 54; inset: var(--header) 0 0; background: rgba(2,6,23,.48); }
  .main { padding: 18px; }
  .hero { min-height: 330px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .brand small { display: none; }
  .main { padding: 12px; }
  .hero { min-height: 300px; padding: 28px 14px; border-radius: 18px; }
  .card, .content-section { padding: 18px; border-radius: 18px; }
  .col-8, .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; }
  .list-item { align-items: flex-start; flex-direction: column; }
  .list-actions { width: 100%; }
  .list-actions .btn { flex: 1; }
  .tool-number { font-size: clamp(48px, 17vw, 88px); }
}

dialog { width: min(520px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--text); padding: 0; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(2,6,23,.58); backdrop-filter: blur(5px); }
.dialog-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:20px 22px; border-bottom:1px solid var(--line); }
.dialog-head h2 { margin:0; font-size:20px; }
.dialog-body { padding:22px; }
.dialog-foot { display:flex; justify-content:flex-end; gap:10px; padding:16px 22px; border-top:1px solid var(--line); }
.switch-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--line); }
.switch-row:last-child { border-bottom:0; }

/* Share toolbar + embeddable source-code dialog */
.share-panel {
  padding: 0 28px;
}
.share-panel-inner {
  max-width: 1364px;
  margin: 6px auto 0;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.share-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.share-heading strong { font-size: 14px; color: var(--text); }
.share-heading span { font-size: 12px; color: var(--muted); }
.share-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.share-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  color: #fff;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  transition: transform .14s ease, filter .14s ease;
}
.share-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.share-btn:focus-visible, .source-code-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 32%, transparent); outline-offset: 2px; }
.share-word { font-size: 9px; letter-spacing: -.04em; }
.share-x { background: #050505; font-size: 20px; font-weight: 500; }
.share-facebook { background: #4267b2; font-family: Arial, sans-serif; font-size: 24px; }
.share-naver { background: #03c75a; font-family: Arial, sans-serif; }
.share-whatsapp { background: #25d366; font-family: Arial, sans-serif; }
.share-blogger { background: #ff8000; font-family: Arial, sans-serif; }
.share-tumblr { background: #35465c; font-family: Georgia, serif; font-size: 23px; }
.share-reddit { background: #ff4500; font-family: Arial, sans-serif; }
.share-pinterest { background: #bd081c; font-family: Georgia, serif; font-size: 19px; }
.source-code-btn {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: #0ea5e9;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.source-code-btn:hover { background: #0284c7; }

.source-dialog {
  width: min(640px, calc(100% - 28px));
  max-height: min(92vh, 860px);
  overflow: auto;
  border-radius: 16px;
}
.source-dialog-head {
  background: #0ea5e9;
  border-bottom: 0;
  color: #fff;
}
.source-dialog-head .icon-btn {
  color: #fff;
  background: transparent;
  border-color: rgba(255,255,255,.3);
}
.source-dialog-head .icon-btn:hover { border-color: #fff; color: #fff; }
.source-dialog-body { display: grid; gap: 16px; }
.source-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-size: 14px;
  color: var(--text);
}
.source-toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.source-size-field { margin-top: 2px; }
.source-code-area {
  min-height: 112px !important;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.source-code-actions { display: flex; justify-content: flex-end; margin-top: -8px; }
.source-preview-label { font-size: 13px; font-weight: 750; color: var(--muted); }
.source-preview-wrap {
  width: 100%;
  min-height: 270px;
  display: grid;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px;
}
.source-preview-wrap iframe {
  display: block;
  max-width: 100%;
  border: 0;
  background: #fff;
}

/* ===== NowClock V3: world-clock homepage, ad slot, unified footer ===== */
.world-hero-location { display:flex; justify-content:center; align-items:baseline; gap:8px; color:var(--muted); font-size:clamp(16px,2vw,24px); }
.world-hero-location strong { color:var(--text); font-weight:650; }
.world-hero-location span { font-size:.72em; }
.world-hero .live-clock { margin-top:20px; }
.compact-hero { min-height:240px; }

.ad-banner { margin-top:18px; }
.ad-banner-inner {
  min-height:110px;
  width:100%;
  display:grid;
  place-items:center;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--panel);
}
.ad-placeholder { width:100%; min-height:108px; display:grid; place-items:center; align-content:center; gap:3px; text-align:center; color:var(--muted); background:repeating-linear-gradient(-45deg,var(--panel),var(--panel) 10px,var(--panel-soft) 10px,var(--panel-soft) 20px); }
.ad-placeholder strong { font-size:13px; color:var(--text); }
.ad-placeholder span { font-size:11px; }
.ad-banner ins.adsbygoogle { width:100%; min-height:90px; }

.world-clock-panel .card-title-row { align-items:flex-start; }
.world-actions { opacity:1; }
.world-actions button { display:grid; place-items:center; cursor:pointer; }
.world-actions .world-view:hover { color:var(--primary); border-color:var(--primary); }
.world-city-info h2 { margin-bottom:18px; }
.world-info-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.world-info-grid > div { display:grid; gap:5px; padding:16px; border-radius:14px; background:var(--panel-soft); }
.world-info-grid strong { font-size:14px; overflow-wrap:anywhere; }
.world-city-description [data-desc-name] { white-space:nowrap; }
.world-add-dialog { width:min(600px,calc(100% - 28px)); }
.world-add-head { background:var(--primary); color:#fff; border-bottom:0; }
.world-add-head .icon-btn { background:transparent; color:#fff; border-color:rgba(255,255,255,.35); }
.world-add-head .icon-btn:hover { color:#fff; border-color:#fff; }

/* Footer shares the same visual foundation as the left navigation. */
.site-footer {
  margin-top:34px;
  padding:28px 28px 34px;
  background:#101827;
  color:#cbd5e1;
  border-top:1px solid rgba(255,255,255,.06);
}
.footer-stack { max-width:1420px; display:grid; justify-items:center; gap:18px; text-align:center; }
.footer-common { display:flex; flex-wrap:wrap; justify-content:center; gap:8px 18px; font-size:13px; }
.footer-common a { color:#dbe4ef; }
.footer-common a:hover { color:#fff; text-decoration:underline; text-underline-offset:3px; }
.footer-share { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:10px; }
.footer-share-label { font-size:12px; color:#94a3b8; }
.footer-copy { font-size:12px; color:#94a3b8; }
.site-footer .source-code-btn { min-height:34px; }

@media (max-width:900px) {
  .world-info-grid { grid-template-columns:1fr; }
}
