:root {
  --bg: #0b1220;
  --bg-deep: #060912;
  --surface: rgba(15, 24, 42, 0.86);
  --surface-strong: rgba(18, 28, 48, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --navy: #d7e3ff;
  --navy-deep: #f8fbff;
  --navy-soft: rgba(215, 227, 255, 0.72);
  --accent: #71b7ff;
  --accent-soft: rgba(113, 183, 255, 0.16);
  --white: #ffffff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.18);
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(113, 183, 255, 0.12), transparent 18%),
    radial-gradient(circle at 86% 14%, rgba(255, 255, 255, 0.08), transparent 14%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--navy-deep);
}

button,
input {
  font: inherit;
}

.auth-brand {
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(2.8rem, 8vw, 4.4rem);
  font-weight: 700;
  color: var(--navy);
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  z-index: 30;
}

.auth-modal.is-hidden {
  display: none;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 33, 56, 0.18);
}

.auth-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
}

.auth-card {
  width: min(100%, 440px);
  background: var(--surface-strong);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.auth-tab {
  min-height: 72px;
  border: 0;
  background: rgba(17, 142, 234, 0.07);
  color: var(--navy-soft);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.is-active {
  background: var(--surface-strong);
  color: var(--navy);
}

.auth-panel {
  display: none;
  padding: 28px 26px 26px;
}

.auth-panel.is-active {
  display: block;
}

.auth-panel h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.7rem, 4vw, 2.1rem);
  font-weight: 800;
  color: var(--navy-deep);
}

.auth-subtitle {
  margin: 10px 0 22px;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--navy-soft);
  text-wrap: pretty;
}

.provider-list,
.login-form {
  display: grid;
  gap: 14px;
}

.provider-button {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(17, 142, 234, 0.28);
  background: rgba(255, 255, 255, 0.88);
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.provider-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
}

.provider-icon.apple {
  background: #111;
  color: #fff;
}

.provider-icon.google {
  background: linear-gradient(135deg, #4285f4, #34a853 55%, #fbbc05 75%, #ea4335 100%);
  color: #fff;
}

.provider-icon.microsoft {
  background: linear-gradient(90deg, #f35325 0 50%, #81bc06 50% 100%);
  color: #fff;
}

.provider-icon.key {
  background: #e7f5ff;
  color: var(--accent);
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.96rem;
}

.login-form input {
  min-height: 52px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(8, 57, 92, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.auth-submit,
.ghost-button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.auth-submit {
  background: var(--navy);
  color: var(--white);
  font-weight: 800;
}

.site-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  padding: 18px;
}

.content-area {
  order: 1;
}

.sidebar {
  order: 2;
}

.logo-card,
.side-thumb,
.gallery-item,
.ghost-button {
  box-shadow: var(--shadow-soft);
}

.logo-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(10px);
}

.logo-word {
  font-family: "Baloo 2", sans-serif;
  font-size: 2.7rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 0.9;
}

.logo-icons {
  display: grid;
  gap: 14px;
}

.side-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(17, 142, 234, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent);
  font-size: 1rem;
  cursor: pointer;
}

.sidebar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.side-thumb {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}

.side-thumb img,
.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.content-area {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.topbar-copy h1,
.topbar-copy p {
  margin: 0;
}

.topbar-kicker {
  color: var(--navy-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.topbar-copy h1 {
  margin-top: 4px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.05;
  color: var(--navy-deep);
  text-wrap: balance;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.68);
  color: var(--navy);
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.wall-note {
  margin: 18px 0 0;
  text-align: center;
  color: var(--navy-soft);
  font-weight: 700;
  font-size: 0.96rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  grid-auto-flow: dense;
  gap: 12px;
}

.gallery-item {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.gallery-item:hover,
.side-thumb:hover,
.provider-button:hover,
.ghost-button:hover,
.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gallery-item.is-wide {
  grid-column: span 2;
  aspect-ratio: 1.55 / 1;
}

.gallery-item.is-tall {
  grid-row: span 2;
  aspect-ratio: 0.84 / 1.44;
}

.gallery-item.is-large {
  grid-column: span 2;
  grid-row: span 2;
  aspect-ratio: 1 / 1;
}

.gallery-item.is-compact {
  aspect-ratio: 0.92 / 0.92;
}

.provider-button:focus-visible,
.auth-tab:focus-visible,
.auth-submit:focus-visible,
.ghost-button:focus-visible,
.side-icon:focus-visible,
.side-thumb:focus-visible,
.gallery-item:focus-visible,
.login-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.provider-button,
.ghost-button,
.auth-submit,
.side-thumb,
.gallery-item,
.side-icon,
.auth-tab {
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.provider-button:hover,
.auth-tab:hover:not(.is-active),
.ghost-button:hover,
.side-icon:hover {
  background: rgba(255, 255, 255, 0.96);
}

.auth-tab:hover:not(.is-active) {
  color: var(--navy);
}

.login-form input::placeholder {
  color: rgba(13, 66, 109, 0.38);
}

.content-area,
.sidebar {
  align-self: start;
}

.content-area {
  background: rgba(15, 24, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 18px;
  backdrop-filter: blur(12px);
}

.sidebar {
  position: sticky;
  top: 18px;
}

@media (max-width: 1280px) {
  .site-shell {
    grid-template-columns: 172px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .content-area {
    order: initial;
  }

  .sidebar {
    position: static;
  }

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

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .auth-card {
    border-radius: 18px;
  }

  .auth-tab {
    min-height: 66px;
    font-size: 1.2rem;
  }

  .auth-panel {
    padding: 24px 16px 18px;
  }

  .provider-button {
    font-size: 1.05rem;
  }

  .site-shell {
    padding: 10px;
  }

  .logo-card {
    border-radius: 18px;
  }

  .content-area {
    padding: 14px;
    border-radius: 22px;
  }

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

  .gallery-item.is-wide,
  .gallery-item.is-large {
    grid-column: span 2;
  }

  .gallery-item.is-tall {
    grid-row: span 1;
    aspect-ratio: 1 / 1;
  }
}
