* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --ink: #f3efe6;
  --muted: #b7c0cc;
  --line: rgba(243, 239, 230, 0.22);
  --gold: #e7c27a;
  --gold-ink: #1a140c;
  --bg: #0e1218;
}

html,
body {
  min-height: 100%;
}

body {
  background:
    radial-gradient(900px 520px at 50% -12%, #2a384c 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  min-height: 2.75rem;
  cursor: pointer;
}

button.primary,
#add {
  background: var(--gold);
  color: var(--gold-ink);
  border-color: transparent;
  font-weight: 600;
}

button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--gold-ink);
  border-color: transparent;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main {
  width: min(960px, 100%);
  margin: 0 auto;
  padding:
    max(1.25rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.when {
  margin-bottom: 0.85rem;
}

.clock {
  font-size: clamp(3.4rem, 12vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 560;
}

.date,
.hint,
.status,
.empty {
  color: var(--muted);
}

.date {
  margin-top: 0.2rem;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.today {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.15rem;
}

.panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem 0.95rem;
}

.today h2 {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  font-size: 1.15rem;
  font-weight: 600;
}

.panel p + p {
  margin-top: 0.35rem;
}

.sun {
  margin-top: 0.7rem;
  color: var(--muted);
}

.forecast {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.75rem;
  list-style: none;
}

.forecast li {
  display: grid;
  gap: 0.1rem;
  justify-items: center;
  font-size: 0.78rem;
  text-align: center;
}

.forecast .day,
.forecast li span:last-child {
  color: var(--muted);
}

.forecast .temp {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.facts {
  display: grid;
  gap: 0.7rem;
}

.panel a {
  color: var(--gold);
}

.quote {
  margin: 0;
  border-left: 3px solid var(--gold);
}

.quote footer {
  margin-top: 0.35rem;
  color: var(--muted);
}

@media (min-width: 800px) {
  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.search {
  margin: 1.1rem 0 0.4rem;
}

.search input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1rem;
}

.status,
.hint,
.empty {
  margin-top: 0.8rem;
  font-size: 0.92rem;
}

.container {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem 0.35rem;
  margin-top: 1.25rem;
}

@media (min-width: 720px) {
  .container {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.app.dragging {
  opacity: 0.28;
  pointer-events: none;
}

.app.ghost {
  position: fixed;
  z-index: 30;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  transform: scale(1.06);
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.45));
}

.app.ghost .remove {
  display: none;
}

.mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 1.15rem;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
}

.app:active .mark {
  transform: scale(0.96);
}

.badge {
  position: absolute;
  right: -0.3rem;
  bottom: -0.2rem;
  padding: 0.05rem 0.28rem;
  border-radius: 999px;
  background: #1a140c;
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.name {
  max-width: 5.4rem;
  font-size: 0.75rem;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.remove {
  position: absolute;
  top: -0.35rem;
  right: 0.15rem;
  width: 1.6rem;
  height: 1.6rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #f3efe6;
  color: #1a140c;
  font-size: 1.1rem;
  line-height: 1;
}

dialog {
  width: min(24rem, calc(100% - 2rem));
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #171c24;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(6, 8, 12, 0.72);
}

dialog h2 {
  font-size: 1.15rem;
  margin-bottom: 0.8rem;
}

dialog label {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

dialog input {
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: #0e1218;
  font-size: 1rem;
}

.form-error {
  color: #e08b7d;
  margin-bottom: 0.7rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

@media (prefers-reduced-motion: reduce) {
  .app:active .mark {
    transform: none;
  }
}
