/* Aion 2 Timers: a second-screen companion, dark by design. Deep slate
   surfaces, warm gold for what is open right now, violet for Odyle Energy.
   Cinzel (OFL) carries the display voice; everything else is the system UI
   face with tabular numerals. */

@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/cinzel-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b25;
  --panel-raised: #1a2230;
  --line: #2a3443;
  --line-strong: #3b4759;
  --fg: #ece6da;
  --muted: #a9b1bd;
  --faint: #7f8896;
  --gold: #d9a74a;
  --gold-ink: #f0c86c;
  --gold-wash: rgba(217, 167, 74, 0.1);
  --energy: #9aa0ff;
  --energy-deep: #5b63e8;
  --energy-ink: #c2c5ff;
  --display: "Cinzel", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--fg);
  font: 15.5px/1.5 var(--body);
  scrollbar-color: var(--line-strong) var(--bg);
  accent-color: var(--gold);
  caret-color: var(--gold);
}

body {
  margin: 0 auto;
  padding: 28px 16px 56px;
  max-width: 1080px;
  background:
    radial-gradient(900px 320px at 50% -120px, rgba(217, 167, 74, 0.1), transparent 70%),
    var(--bg);
}

::selection {
  background: var(--gold);
  color: #1b1407;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

h3 {
  font-size: 1.05rem;
  letter-spacing: 0.03em;
}

p {
  margin: 0;
}

a {
  color: var(--gold-ink);
  text-underline-offset: 3px;
}

.num,
.clock,
.big,
.tick-energy,
.tick-time,
dd,
input[type="number"] {
  font-variant-numeric: tabular-nums;
}

/* ---- masthead ----------------------------------------------------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 32px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.sub {
  color: var(--muted);
  margin-top: 6px;
}

.region {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- sections ----------------------------------------------------- */

section {
  margin-top: 36px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lead {
  color: var(--muted);
  font-size: 0.9rem;
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- content cards ------------------------------------------------ */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.8);
  transition: border-color 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.card.is-open {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-wash), transparent 55%), var(--panel-raised);
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.9);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.state {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.is-open .state {
  color: var(--gold-ink);
}

.clock {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.clock .unit {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.window {
  height: 4px;
  margin: 10px 0 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.window-fill {
  height: 100%;
  background: var(--gold);
  transition: width 1s linear;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  white-space: nowrap;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.meta dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.meta dd {
  margin: 2px 0 0;
  font-size: 0.92rem;
}

.note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* ---- switch ------------------------------------------------------- */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch .knob {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--line-strong);
  transition: background 0.25s var(--ease-out);
}

.switch .knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

.switch input:checked + .knob {
  background: var(--gold);
}

.switch input:checked + .knob::after {
  transform: translateX(14px);
  background: #1b1407;
}

.switch input:checked ~ .switch-label {
  color: var(--fg);
}

.switch input:focus-visible + .knob {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---- energy ------------------------------------------------------- */

.panel {
  padding: 20px 22px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.8);
}

.energy-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  flex-wrap: wrap;
}

.energy-now {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.big {
  font-family: var(--display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--energy-ink);
}

.of {
  color: var(--muted);
}

.tag {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-wash);
  color: var(--gold-ink);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.energy-next {
  color: var(--muted);
  font-size: 0.92rem;
}

.energy-next strong {
  color: var(--fg);
  font-weight: 600;
}

.sep {
  margin-left: 8px;
}

.empty {
  color: var(--muted);
  max-width: 60ch;
}

/* The track runs from now (left) to full (right). Ticks are recharges;
   labelled ones show energy above and time below, every tick shows both
   on hover. Day boundaries hang from the top as dashed lines. */

.track {
  position: relative;
  margin: 26px 0 10px;
  padding: 48px 0 30px;
}

.track-days {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Day labels get their own row above the energy figures, and the dashed
   line hangs from there down through the rail. */
.day {
  position: absolute;
  top: 0;
  bottom: 8px;
  transform: translateX(-50%);
  border-left: 1px dashed var(--line-strong);
  padding-left: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  line-height: 1;
}

.rail {
  position: relative;
  height: 6px;
  margin: 0 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--energy-deep), var(--energy));
}

.tick {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 12px;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border-radius: 1px;
  outline: 2px solid var(--panel);
  cursor: default;
}

.tick::before {
  /* hit target */
  content: "";
  position: absolute;
  inset: -12px -10px;
}

.tick.labelled {
  height: 16px;
}

.tick.last {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  outline: 3px solid var(--panel);
}

.tick-energy,
.tick-time,
.track-now span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.78rem;
  line-height: 1;
}

.tick-energy {
  top: -24px;
  color: var(--fg);
  font-weight: 600;
}

.tick-time {
  bottom: -24px;
  color: var(--muted);
}

.last .tick-energy {
  color: var(--gold-ink);
}

.last .tick-time {
  color: var(--gold-ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.track-now {
  position: absolute;
  left: 6px;
  top: 50%;
  width: 0;
}

.track-now .tick-energy {
  top: -27px;
  left: 0;
  transform: none;
  color: var(--energy-ink);
}

.track-now .tick-time {
  bottom: -27px;
  left: 0;
  transform: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.tick::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

.tick:hover::after,
.tick:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tick:hover {
  z-index: 1;
}

/* ---- form --------------------------------------------------------- */

.energy-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 22px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.energy-form > label:not(.switch) {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.duration {
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--fg);
}

/* Free / Subscriber as a segmented control: it reads as a field like the
   inputs beside it and sits on the same baseline instead of floating as a
   lone switch. */
.segmented {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.segmented legend {
  padding: 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.segmented .options {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.segmented label {
  position: relative;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 5px;
  color: var(--muted);
  line-height: 1.5;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.segmented label:hover span {
  color: var(--fg);
}

.segmented input:checked + span {
  background: var(--gold-wash);
  color: var(--gold-ink);
  font-weight: 600;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

select,
input,
button {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 7px 10px;
  transition: border-color 0.2s var(--ease-out);
}

select:hover,
input:hover {
  border-color: var(--faint);
}

select:focus-visible,
input:focus-visible {
  border-color: var(--gold);
  outline-offset: 0;
}

input[type="number"] {
  width: 6.5em;
}

input.narrow {
  width: 3.6em;
  padding: 5px 6px;
}

.lead input.narrow {
  margin: 0 2px;
}

button {
  cursor: pointer;
  padding: 8px 16px;
  font-weight: 600;
}

button[type="submit"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #1b1407;
}

button[type="submit"]:hover {
  background: var(--gold-ink);
  border-color: var(--gold-ink);
}

button.ghost {
  background: transparent;
  color: var(--muted);
}

button.ghost:hover {
  color: var(--fg);
  border-color: var(--faint);
}

/* ---- footer & shell ---------------------------------------------- */

footer {
  margin-top: 44px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.82rem;
}

.loading {
  color: var(--muted);
  padding-top: 40px;
  text-align: center;
}

#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: #ffd9d9;
  color: #5a1111;
}

#blazor-error-ui a {
  color: inherit;
}

#blazor-error-ui .dismiss {
  float: right;
  cursor: pointer;
}

/* ---- responsive --------------------------------------------------- */

@media (max-width: 560px) {
  html {
    font-size: 15px;
  }

  .clock {
    font-size: 1.8rem;
  }

  .tick.labelled:not(.last) .tick-time {
    display: none;
  }

  .actions {
    margin-left: 0;
    width: 100%;
  }

  .actions button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
