:root {
  color-scheme: light;
  --shell-bg: #f4f7fb;
  --menu-bg: #101827;
  --menu-fg: #f8fafc;
  --menu-muted: #9fb0c8;
  --menu-active: #2f6bed;
  --menu-cue: #242c3b;
  --panel-border: #d8e1ee;
  --text-main: #0f172a;
  --text-muted: #65758b;
  --shadow-soft: 0 18px 48px rgba(15, 23, 42, 0.12);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--shell-bg);
  color: var(--text-main);
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.login-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin-bottom: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  object-fit: contain;
}

.login-panel h1 {
  margin: 0 0 24px;
  font-size: 30px;
  line-height: 1.2;
}

.google-login-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid #b9cbe4;
  border-radius: 8px;
  padding: 0 16px;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
}

.google-login-button:hover:not(:disabled) {
  border-color: #8fb5f5;
  box-shadow: 0 0 0 3px rgba(47, 107, 237, 0.12);
}

.google-login-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.google-mark {
  width: 26px;
  height: 26px;
  border: 1px solid #d8e1ee;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f6bed;
  font-weight: 800;
  line-height: 1;
}

.login-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-status.is-error {
  color: #8a1f17;
}

.app-shell {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  overflow: hidden;
}

.shell-menu {
  position: relative;
  z-index: 10;
  width: 72px;
  height: 100dvh;
  min-height: 0;
  padding: 18px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--menu-bg);
  color: var(--menu-fg);
  box-shadow: var(--shadow-soft);
  transition: width 160ms ease;
}

.shell-menu.is-expanded,
.shell-menu:hover {
  width: 220px;
}

.menu-toggle {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: width 160ms ease;
}

.logo-placeholder {
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 6px;
  transition: width 160ms ease;
}

.logo-placeholder img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shell-menu:hover .menu-toggle,
.shell-menu.is-expanded .menu-toggle {
  width: 152px;
}

.shell-menu:hover .logo-placeholder,
.shell-menu.is-expanded .logo-placeholder {
  width: 140px;
}

.menu-cue {
  position: absolute;
  top: 50%;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 28px;
  opacity: 1;
  transform-origin: center;
  transform: translateY(-50%);
  transition: opacity 140ms ease, transform 160ms ease;
}

.menu-cue span {
  width: 15px;
  height: 15px;
  border-right: 3px solid var(--menu-cue);
  border-bottom: 3px solid var(--menu-cue);
  transform: rotate(-45deg);
}

.menu-cue span + span {
  margin-left: -7px;
}

.menu-cue:hover {
  transform: translateY(-50%) scale(1.18);
}

.shell-menu:hover .menu-cue,
.shell-menu.is-expanded .menu-cue {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px) scale(0.7);
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 32px;
}

.menu-item {
  min-height: 44px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: var(--menu-fg);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.shell-menu.is-expanded .menu-item,
.shell-menu:hover .menu-item {
  opacity: 1;
  transform: translateX(0);
}

.menu-item:hover,
.menu-item.is-active {
  background: var(--menu-active);
}

.logout-button {
  margin-top: 18px;
}

.module-host {
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  padding: 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
}

.module-host.is-flush-scroll-host {
  padding-block: 0;
}

.shell-message {
  max-width: 640px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  color: var(--text-muted);
}

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

@media (max-width: 720px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .shell-menu {
    --mobile-menu-top: 72px;
    position: fixed;
    top: var(--mobile-menu-top);
    left: 0;
    width: 54px;
    min-height: auto;
    height: 64px;
    padding: 8px 6px 8px 0;
    overflow: hidden;
    border-radius: 0 16px 16px 0;
    opacity: 0.73;
    transition: width 160ms ease, height 160ms ease, border-radius 160ms ease;
  }

  .shell-menu.is-dragging {
    transition: none;
  }

  .shell-menu.is-expanded {
    top: 0;
    width: clamp(132px, 30vw, 220px);
    height: auto;
    max-height: calc(100dvh - 18px);
    padding: 12px;
    overflow-y: auto;
    border-radius: 0 16px 16px 0;
    opacity: 1;
  }

  .shell-menu:hover {
    width: 54px;
  }

  .shell-menu.is-expanded:hover {
    width: clamp(132px, 30vw, 220px);
  }

  .menu-toggle {
    width: 48px;
    height: 48px;
    border-radius: 0 12px 12px 0;
    touch-action: none;
    cursor: grab;
  }

  .shell-menu.is-dragging .menu-toggle {
    cursor: grabbing;
  }

  .shell-menu.is-expanded .menu-toggle,
  .shell-menu.is-expanded:hover .menu-toggle {
    width: 100%;
    border-radius: 8px;
    justify-content: flex-start;
    padding: 0 8px;
    cursor: pointer;
  }

  .logo-placeholder,
  .shell-menu:hover .logo-placeholder,
  .shell-menu.is-expanded .logo-placeholder,
  .shell-menu.is-expanded:hover .logo-placeholder {
    width: 38px;
    height: 38px;
  }

  .menu-cue {
    display: none;
  }

  .shell-menu:hover .menu-item {
    opacity: 0;
    transform: translateX(-8px);
  }

  .shell-menu.is-expanded .menu-item,
  .shell-menu.is-expanded:hover .menu-item {
    opacity: 1;
    transform: translateX(0);
  }

  .menu-list {
    margin-top: 18px;
  }

  .menu-item {
    min-height: 42px;
    padding: 0 10px;
    font-size: 15px;
  }

  .module-host {
    height: auto;
    overflow: visible;
    padding: 18px 12px 28px;
  }

  .module-host.is-flush-scroll-host {
    padding: 18px 12px 28px;
  }
}
