:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: rgba(255, 255, 255, 0.95);
  --surface-hover: rgba(255, 255, 255, 0.98);
  --widget-surface: rgba(255, 255, 255, 0.60);
  --widget-border: rgba(255, 255, 255, 0.42);
  --text: #202124;
  --muted: #5f6368;
  --line: rgba(95, 99, 104, 0.14);
  --accent: #1a73e8;
  --accent-strong: #1558b4;
  --accent-soft: rgba(26, 115, 232, 0.12);
  --shadow: 0 1px 6px rgba(32, 33, 36, 0.16);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17181c;
  --surface: rgba(32, 33, 36, 0.76);
  --surface-solid: rgba(32, 33, 36, 0.9);
  --surface-hover: rgba(40, 42, 45, 0.92);
  --widget-surface: rgba(32, 33, 36, 0.52);
  --widget-border: rgba(255, 255, 255, 0.12);
  --text: #e8eaed;
  --muted: #9aa0a6;
  --line: rgba(232, 234, 237, 0.12);
  --accent: #8ab4f8;
  --accent-strong: #a8c7fa;
  --accent-soft: rgba(138, 180, 248, 0.16);
  --shadow: 0 1px 8px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.52), rgba(255,255,255,0.70)),
    url("./assets/background-illustration.svg") center bottom / cover no-repeat fixed,
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 180ms ease, color 180ms ease;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(to bottom, rgba(17,18,22,0.55), rgba(17,18,22,0.72)),
    url("./assets/background-illustration.svg") center bottom / cover no-repeat fixed,
    var(--bg);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.24);
  outline-offset: 3px;
}

.background-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.orb-one {
  top: -180px;
  left: -140px;
  width: 420px;
  height: 420px;
  background: rgba(66, 133, 244, 0.08);
}

.orb-two {
  right: -180px;
  bottom: -220px;
  width: 480px;
  height: 480px;
  background: rgba(52, 168, 83, 0.08);
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, background 160ms ease;
  backdrop-filter: blur(8px);
}

.icon-button:hover {
  transform: translateY(-1px);
  background: var(--surface-hover);
}

.hero {
  max-width: 760px;
  margin: 18px auto 26px;
  text-align: center;
}

.date-text,
.widget-secondary {
  color: var(--muted);
}

.date-text {
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 500;
}

.search-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 10px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: var(--surface-solid);
  box-shadow: 0 2px 14px rgba(32, 33, 36, 0.12);
  backdrop-filter: blur(10px);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.search-form:hover,
.search-form:focus-within {
  border-color: rgba(26, 115, 232, 0.18);
  box-shadow: 0 4px 16px rgba(32, 33, 36, 0.16);
}

.search-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  color: #9aa0a6;
}

.search-icon svg,
.search-submit svg {
  width: 100%;
  height: 100%;
}

.search-form input {
  min-width: 0;
  height: 50px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.search-form input::placeholder {
  color: var(--muted);
}

.search-submit {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.search-submit:hover {
  background: var(--accent-soft);
}

section + section {
  margin-top: 18px;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.widget-card {
  min-height: 142px;
  padding: 16px;
  border: 1px solid var(--widget-border);
  border-radius: var(--radius-md);
  background: var(--widget-surface);
  box-shadow: 0 10px 30px rgba(46, 67, 52, 0.10);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.widget-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.widget-icon {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.98rem;
}

.widget-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.clock-time,
.weather-temperature {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.clock-date {
  margin: 6px 0 0;
  font-size: 0.82rem;
}

.weather-location {
  margin: 2px 0 0;
  font-size: 0.74rem;
}

.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.weather-symbol {
  margin: 0;
  font-size: 2.4rem;
}

.weather-description {
  margin: 4px 0 10px;
  font-size: 0.92rem;
  font-weight: 600;
}

.weather-details {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px 8px;
}

.app-card {
  display: flex;
  min-width: 0;
  padding: 8px 4px;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.app-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
}

.app-icon-shell {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .app-icon-shell {
  background: rgba(32, 33, 36, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
}

.app-icon-image {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.app-icon-fallback {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
}

.app-icon-fallback[hidden],
.app-icon-image[hidden] {
  display: none;
}

.app-name {
  width: 100%;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,0.4);
  backdrop-filter: blur(8px);
}

.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;
}

@media (max-width: 1180px) {
  .app-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 18px, 1280px);
    padding-top: 10px;
  }

  .hero {
    margin-bottom: 20px;
  }

  .search-form {
    padding-left: 14px;
  }

  .search-form input {
    height: 46px;
    font-size: 0.95rem;
  }

  .widget-grid {
    grid-template-columns: 1fr;
  }

  .app-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
