:root {
  color-scheme: dark;
  --night: #111019;
  --night-soft: #191721;
  --card: #1b1923;
  --card-raised: #211e2a;
  --line: #34303b;
  --line-soft: #292631;
  --ink: #f2eee8;
  --muted: #a19ba8;
  --dim: #77717f;
  --violet: #bc9dff;
  --violet-deep: #8f6de0;
  --green: #b8d69a;
  --green-dim: #778b65;
  --mono: "DM Mono", monospace;
  --fa: "Vazirmatn", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 88% 12%, #30253d55, transparent 34rem),
    radial-gradient(ellipse at 8% 72%, #26332235, transparent 35rem),
    var(--night);
  font-family: var(--fa);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(#ffffff04 1px, transparent 1px), linear-gradient(90deg, #ffffff04 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  mask-image: linear-gradient(to bottom, #0009, transparent 74%);
  pointer-events: none;
}

.ambient { position: fixed; z-index: -1; border: 1px solid #bc9dff0c; border-radius: 50%; pointer-events: none; }
.ambient-one { width: 560px; height: 560px; top: 210px; right: -440px; }
.ambient-two { width: 370px; height: 370px; bottom: -210px; left: -250px; border-color: #b8d69a0c; }
.site-shell { width: min(1100px, calc(100% - 56px)); margin: 0 auto; }

.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff12; }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { color: var(--ink); font: 500 18px var(--mono); letter-spacing: -1.8px; }
.brand-mark-dot, .footer-brand span { color: var(--green); }
.brand-copy { display: grid; gap: 2px; padding-right: 13px; border-right: 1px solid #ffffff25; }
.brand-copy strong { font-size: 12px; font-weight: 600; }
.brand-copy small { color: var(--dim); font: 9px var(--mono); letter-spacing: 1px; direction: ltr; text-align: right; }
.top-nav { display: flex; align-items: center; gap: 14px; }
.home-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; text-decoration: none; transition: color .18s; }
.home-link:hover { color: var(--green); }
.home-link span { color: var(--green); font: 12px var(--mono); }
.theme-toggle { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #ffffff20; border-radius: 50%; background: #ffffff08; color: var(--green); font: 18px var(--fa); cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.theme-toggle:hover { transform: rotate(-12deg); border-color: var(--violet); background: #bc9dff12; }

.world-section, .convert-section { padding-top: 29px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-index { color: var(--green); font: 10px var(--mono); }
.section-heading h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section-caption { display: flex; align-items: center; gap: 10px; color: var(--dim); font: 8px var(--mono); letter-spacing: 1.2px; direction: ltr; }
.caption-line { width: 27px; height: 1px; background: #534e59; }
.clocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.clock-card { min-height: 165px; position: relative; overflow: hidden; padding: 17px 19px 14px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, #211e29, #191720 74%); }
.clock-card::after { position: absolute; right: -48px; bottom: -77px; width: 160px; height: 160px; border: 1px solid #bc9dff13; border-radius: 50%; content: ""; box-shadow: 0 0 0 17px #bc9dff04, 0 0 0 34px #bc9dff03; pointer-events: none; }
.clock-seoul::after { border-color: #b8d69a19; box-shadow: 0 0 0 17px #b8d69a05, 0 0 0 34px #b8d69a03; }
.clock-top, .location { display: flex; align-items: center; }
.clock-top { justify-content: space-between; }
.location { gap: 9px; }
.flag { font-size: 17px; filter: saturate(.85); }
.flag-world { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid #77707f; border-radius: 50%; color: var(--violet); font: 13px var(--mono); }
.location b, .location small { display: block; }
.location b { color: #e9e4eb; font-size: 12px; font-weight: 500; }
.location small { margin-top: 2px; color: var(--dim); font: 9px var(--mono); direction: ltr; text-align: right; }
.clock-index { color: #716a79; font: 8px var(--mono); letter-spacing: .5px; direction: ltr; }
.clock-main { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; direction: ltr; }
.clock-time-group { min-width: 0; }
.clock-time { color: var(--ink); font: 500 clamp(34px, 4vw, 43px)/1 var(--mono); letter-spacing: -2px; white-space: nowrap; }
.clock-ampm { margin-left: 3px; color: var(--violet); font: 500 11px var(--mono); letter-spacing: 0; vertical-align: middle; }
.clock-24 { margin-top: 4px; color: #87818e; font: 10px var(--mono); direction: ltr; white-space: nowrap; }
.seconds-module { display: grid; width: 48px; min-height: 48px; flex: 0 0 48px; align-content: center; justify-items: center; gap: 2px; border: 1px solid #b8d69a3d; border-radius: 8px; background: #b8d69a0a; }
.seconds-value { color: var(--green); font: 500 20px/1 var(--mono); font-variant-numeric: tabular-nums; }
.seconds-label { color: var(--dim); font-size: 8px; line-height: 1.2; }
.spoken-time { min-height: 17px; margin-top: 7px; color: #d5c9e4; font-size: 12px; font-weight: 600; line-height: 1.6; }
.spoken-time-ko { direction: ltr; text-align: right; color: #ccddb9; font-family: var(--fa); font-size: 12px; font-weight: 600; }
.clock-bottom { display: flex; justify-content: space-between; gap: 5px; margin-top: 13px; padding-top: 9px; border-top: 1px solid #ffffff10; color: var(--muted); font-size: 10px; }
.clock-bottom span:last-child { color: #746e7c; font: 9px var(--mono); direction: ltr; }

.convert-section { padding-top: 36px; }
.converter { position: relative; overflow: hidden; padding: 23px 25px 13px; border: 1px solid #393340; border-radius: 12px; background: linear-gradient(130deg, #201d29, #18161f 70%); }
.converter::before { position: absolute; top: -125px; left: 20%; width: 280px; height: 200px; border: 1px solid #bc9dff0a; border-radius: 50%; content: ""; box-shadow: 0 0 0 18px #bc9dff03, 0 0 0 38px #bc9dff02; pointer-events: none; }
.converter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.converter-kicker { color: var(--green); font-size: 10px; }
.converter-head h3 { margin: 1px 0 0; font-size: 20px; font-weight: 500; }
.route-mark { display: flex; align-items: center; gap: 6px; color: var(--violet); }
.route-mark span { width: 6px; height: 6px; border: 1px solid var(--violet); border-radius: 50%; }.route-mark i { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #bc9dff33; border-radius: 50%; font: 17px var(--mono); font-style: normal; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { display: block; margin-bottom: 7px; color: #d7d1dd; font-size: 11px; font-weight: 500; }
.select-shell { position: relative; }
select, input { width: 100%; min-width: 0; min-height: 45px; padding: 10px 13px; border: 1px solid #393541; border-radius: 7px; outline: none; background: #14121a; color: var(--ink); font: 12px var(--fa); transition: border-color .18s, box-shadow .18s; }
select { padding-left: 34px; appearance: none; }
select:focus, input:focus { border-color: #a78be0; box-shadow: 0 0 0 3px #a78be015; }
.select-arrow { position: absolute; top: 8px; left: 13px; color: var(--violet); font-size: 17px; pointer-events: none; }
.datetime { display: grid; grid-template-columns: 1.2fr .8fr; gap: 8px; }
input[type="date"], input[type="time"] { color-scheme: dark; font-family: var(--mono); font-size: 11px; }
.dest-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 19px 0 10px; }
.dest-head .field-label { margin: 0; }
.search-box { width: min(270px, 50%); position: relative; }
.search-box input { min-height: 36px; padding: 8px 33px 8px 11px; border-color: #34303a; border-radius: 6px; font-family: var(--fa); font-size: 10px; }
.search-icon { position: absolute; z-index: 1; top: 3px; right: 11px; color: var(--green); font: 23px var(--fa); transform: rotate(-20deg); }
.choices { display: flex; flex-wrap: wrap; gap: 7px; }
.choice { position: relative; }
.choice[hidden] { display: none; }
.choice input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.choice label { display: flex; min-height: 33px; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid #393540; border-radius: 5px; background: #17151d; color: #bcb6c3; font-size: 10px; cursor: pointer; transition: .18s ease; user-select: none; }
.choice label::before { display: grid; width: 13px; height: 13px; place-items: center; border: 1px solid #68616e; border-radius: 3px; color: transparent; content: "✓"; font-size: 9px; }
.choice input:checked + label { border-color: #846bb2; background: #352c42; color: #f1e9ff; }
.choice input:checked + label::before { border-color: var(--violet); background: var(--violet); color: #211a2c; }
.choice input:focus-visible + label { outline: 2px solid var(--green); outline-offset: 2px; }
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 13px; }
.result { min-height: 78px; padding: 10px 12px; border: 1px solid #37333e; border-radius: 7px; background: #17151e; }
.result-top { display: flex; align-items: center; justify-content: space-between; color: #cbc5d1; font-size: 10px; }
.result-top span:last-child { color: var(--green); font: 8px var(--mono); text-transform: uppercase; }
.result-time { margin-top: 5px; color: var(--ink); font: 500 22px var(--mono); direction: ltr; text-align: right; }
.result-date { margin-top: 2px; color: #8f8997; font-size: 9px; }
.empty { padding: 10px 0; color: var(--dim); font-size: 11px; }
.page-footer { display: flex; align-items: center; gap: 10px; padding: 25px 4px 29px; color: #716b78; font-size: 10px; }
.footer-brand { color: #bcb5c4; font: 10px var(--mono); }.footer-leaf { margin-right: auto; color: var(--green-dim); }

html[data-theme="light"] {
  color-scheme: light;
  --night: #f3f1ec;
  --ink: #282430;
  --muted: #716b79;
  --dim: #898391;
  --violet: #7756b4;
  --green: #557a43;
  --green-dim: #708660;
}
html[data-theme="light"] body { background: radial-gradient(ellipse at 88% 12%, #e4d8f455, transparent 34rem), radial-gradient(ellipse at 8% 72%, #dbe6d255, transparent 35rem), var(--night); }
html[data-theme="light"] body::before { background-image: linear-gradient(#443a5008 1px, transparent 1px), linear-gradient(90deg, #443a5008 1px, transparent 1px); }
html[data-theme="light"] .ambient { border-color: #7756b41a; }
html[data-theme="light"] .ambient-two { border-color: #557a431a; }
html[data-theme="light"] .topbar { border-color: #3931451b; }
html[data-theme="light"] .brand-copy { border-color: #39314530; }
html[data-theme="light"] .theme-toggle { border-color: #4b405326; background: #ffffff8c; }
html[data-theme="light"] .clock-card { border-color: #dcd6e0; background: linear-gradient(145deg, #fffefa, #f5f2f7 74%); box-shadow: 0 8px 28px #27202e0b; }
html[data-theme="light"] .clock-card::after { border-color: #7756b426; box-shadow: 0 0 0 17px #7756b407, 0 0 0 34px #7756b404; }
html[data-theme="light"] .clock-seoul::after { border-color: #557a432b; box-shadow: 0 0 0 17px #557a4308, 0 0 0 34px #557a4304; }
html[data-theme="light"] .location b { color: #302a37; }
html[data-theme="light"] .flag-world { border-color: #b5aeb9; }
html[data-theme="light"] .clock-index { color: #958e9b; }
html[data-theme="light"] .seconds-module { border-color: #557a4340; background: #557a4309; }
html[data-theme="light"] .clock-bottom { border-color: #48405119; }
html[data-theme="light"] .clock-bottom span:last-child { color: #85808a; }
html[data-theme="light"] .caption-line { background: #aaa3af; }
html[data-theme="light"] .converter { border-color: #d9d3dc; background: linear-gradient(130deg, #fffefa, #f7f4f8 70%); box-shadow: 0 12px 34px #27202e0b; }
html[data-theme="light"] .converter::before { border-color: #7756b414; box-shadow: 0 0 0 18px #7756b406, 0 0 0 38px #7756b403; }
html[data-theme="light"] .field-label { color: #47414d; }
html[data-theme="light"] select, html[data-theme="light"] input { border-color: #d8d2dd; background: #fffefa; color: #302a37; }
html[data-theme="light"] input[type="date"], html[data-theme="light"] input[type="time"] { color-scheme: light; }
html[data-theme="light"] select:focus, html[data-theme="light"] input:focus { border-color: #9275c5; box-shadow: 0 0 0 3px #7756b414; }
html[data-theme="light"] .search-box input { border-color: #d8d2dd; }
html[data-theme="light"] .choice label { border-color: #ded8e2; background: #fffefa; color: #544d5b; }
html[data-theme="light"] .choice label::before { border-color: #aaa3af; }
html[data-theme="light"] .choice input:checked + label { border-color: #9275c5; background: #eee7f8; color: #382b4d; }
html[data-theme="light"] .choice input:checked + label::before { border-color: #7756b4; background: #7756b4; color: white; }
html[data-theme="light"] .result { border-color: #e0dbe4; background: #fffefa; }
html[data-theme="light"] .result-top { color: #494351; }
html[data-theme="light"] .result-date { color: #79727f; }
html[data-theme="light"] .page-footer { color: #77717f; }
html[data-theme="light"] .footer-brand { color: #494351; }


@media (max-width: 760px) {
  .site-shell { width: min(100% - 36px, 580px); }
  .clock-card { padding: 15px 14px 12px; }
  .clock-index { font-size: 7px; }
  .clock-time { font-size: clamp(29px, 6vw, 38px); }
  .clock-24 { font-size: 9px; }
}

@media (max-width: 580px) {
  .site-shell { width: calc(100% - 30px); }
  .topbar { min-height: 72px; }
  .top-nav { gap: 10px; }
  .theme-toggle { width: 32px; height: 32px; }
  .brand-copy { padding-right: 9px; }.brand-copy strong { font-size: 10px; }.brand-copy small { font-size: 8px; }
  .clocks { grid-template-columns: 1fr; gap: 8px; }
  .clock-card { min-height: 139px; padding: 14px 16px 11px; }
  .clock-main { margin-top: 10px; }.clock-time { font-size: 38px; }.clock-24 { font-size: 10px; }
  .seconds-module { width: 44px; min-height: 44px; flex-basis: 44px; }.seconds-value { font-size: 18px; }
  .clock-bottom { margin-top: 9px; padding-top: 7px; }
  .world-section, .convert-section { padding-top: 25px; }
  .section-heading h2 { font-size: 14px; }.section-caption { font-size: 7px; }
  .converter { padding: 19px 14px 12px; }
  .converter-head h3 { font-size: 18px; }
  .controls { grid-template-columns: 1fr; gap: 11px; }
  .datetime { grid-template-columns: 1.2fr .8fr; }
  .dest-head { align-items: start; flex-direction: column; gap: 10px; }
  .search-box { width: 100%; }
  .choices { gap: 6px; }.choice label { padding: 5px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
