:root {
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-soft: 0 12px 40px rgba(0, 0, 0, 0.22);
  --bg-main: radial-gradient(circle at 20% -10%, #20283f, #0d111d 45%, #090c16);
  --bg-card: rgba(255, 255, 255, 0.08);
  --text-main: #f2f5ff;
  --text-muted: #c5cbdf;
  --line-subtle: rgba(255, 255, 255, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  transition: background 250ms ease, color 250ms ease;
}

body[data-theme="light"] {
  --bg-main: radial-gradient(circle at 20% -10%, #f7fbff, #edf3ff 45%, #dce7ff);
  --bg-card: rgba(255, 255, 255, 0.62);
  --text-main: #101624;
  --text-muted: #505f7f;
  --line-subtle: rgba(30, 37, 58, 0.12);
  --shadow-soft: 0 12px 40px rgba(50, 63, 96, 0.14);
}

.app-shell {
  width: min(1160px, 100% - 32px);
  margin: 0 auto;
  padding: var(--space-3) 0 var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.glass-panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-subtle);
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(130%);
  box-shadow: var(--shadow-soft);
}

.topbar {
  padding: var(--space-3);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

.install-status {
  margin: -8px 4px 0;
  text-align: right;
}

.eyebrow {
  margin: 0 0 var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-size: 0.72rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.1;
}

h2 {
  margin: 0;
  font-size: 1rem;
}

.search-section,
.favorites-section {
  padding: var(--space-2);
}

#citySearch {
  width: 100%;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  outline: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

body[data-theme="light"] #citySearch {
  background: rgba(255, 255, 255, 0.65);
}

#citySearch:focus {
  border-color: #6ca3ff;
  transform: scale(1.01);
}

.search-meta {
  margin-top: var(--space-1);
  display: flex;
  justify-content: space-between;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.results-list {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  max-height: 280px;
  overflow-y: auto;
}

.results-list:empty {
  display: none;
}

.result-item {
  padding: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: var(--space-1);
  background: rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid var(--line-subtle);
}

.result-item:last-child {
  border-bottom: 0;
}

.result-item:hover,
.result-item.active {
  background: rgba(102, 157, 255, 0.25);
}

.section-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-1);
}

.favorites-list {
  margin-top: var(--space-1);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.chip {
  border: 1px solid var(--line-subtle);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
  padding: 7px 12px;
  font-size: 0.86rem;
  cursor: pointer;
}

.clock-grid {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 1fr;
}

.clock-card {
  border-radius: var(--radius-xl);
  padding: var(--space-2);
  min-height: 218px;
  position: relative;
  display: grid;
  align-content: space-between;
  gap: var(--space-1);
  transition: transform 220ms ease, opacity 220ms ease, background 260ms ease;
  animation: fade-up 280ms ease;
}

.clock-card:hover {
  transform: scale(1.02);
}

.clock-card.day {
  background: linear-gradient(145deg, rgba(117, 168, 255, 0.32), rgba(96, 216, 255, 0.18));
}

.clock-card.night {
  background: linear-gradient(145deg, rgba(56, 65, 114, 0.48), rgba(39, 18, 78, 0.42));
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-1);
}

.city-country {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.city-name {
  margin: 2px 0 0;
  font-size: 1.2rem;
}

.clock-time {
  margin: 0;
  font-size: clamp(2.1rem, 11vw, 4.8rem);
  letter-spacing: 0.03em;
  font-weight: 700;
  line-height: 1;
}

.clock-foot {
  color: var(--text-muted);
  display: grid;
  gap: 2px;
  font-size: 0.9rem;
}

.clock-foot p {
  margin: 0;
}

.day-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.24);
}

.card-actions {
  display: flex;
  gap: 6px;
}

.btn,
.icon-btn {
  border: 1px solid var(--line-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.icon-btn {
  padding: 7px 9px;
}

.btn:hover,
.icon-btn:hover {
  transform: scale(1.02);
  background: rgba(126, 170, 255, 0.25);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.favorite-btn.active {
  color: #ffd869;
}

.skeleton {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  background-size: 180% 100%;
  animation: shimmer 1.15s linear infinite;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: var(--space-2);
  z-index: 99;
}

.modal {
  width: min(680px, 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.modal-header h3 {
  margin: 0;
}

#embedCode {
  width: 100%;
  margin-top: var(--space-1);
  border-radius: 12px;
  border: 1px solid var(--line-subtle);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.modal-actions {
  margin-top: var(--space-1);
  display: flex;
  justify-content: flex-end;
}

.tools-list {
  margin-top: var(--space-1);
  display: grid;
  gap: var(--space-1);
}

@keyframes shimmer {
  from { background-position: 180% 0; }
  to { background-position: -180% 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 760px) {
  .clock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1060px) {
  .clock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}