﻿:root {
  --bg: #eef6ff;
  --paper: #ffffff;
  --panel: #f5fbff;
  --panel-strong: #e5f2ff;
  --ink: #0e1726;
  --muted: #53606f;
  --purple: #0638d8;
  --purple-soft: #b9d4ff;
  --gold: #00b832;
  --green: #00d935;
  --graphite: #505050;
  --line: rgba(0, 48, 150, .18);
  --shadow: 0 24px 70px rgba(0, 38, 120, .14);
  --radius: 8px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body { overflow: hidden; }

button,
select,
a { font: inherit; }

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 56, 200, .35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 50;
  transform: translateY(-140%);
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius);
}

.skip-link:focus { transform: translateY(0); }

.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 360px;
  height: 100vh;
  transition: grid-template-columns .18s ease;
  background:
    linear-gradient(120deg, rgba(0, 56, 200, .08), transparent 34%),
    linear-gradient(180deg, #f9fcff 0%, #edf6ff 100%);
}

.app.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr) 360px; }

.app.info-collapsed { grid-template-columns: 272px minmax(0, 1fr) 0; }

.app.sidebar-collapsed.info-collapsed { grid-template-columns: 0 minmax(0, 1fr) 0; }

.app:fullscreen,
.app.is-presentation {
  width: 100vw;
  height: 100vh;
}

.app.is-presentation {
  position: fixed;
  inset: 0;
  z-index: 35;
}

body.presentation-lock { overflow: hidden; }

.sidebar,
.info {
  min-height: 0;
  min-width: 0;
  background: rgba(255, 253, 248, .82);
  backdrop-filter: blur(14px);
}

.app.sidebar-collapsed .sidebar,
.app.info-collapsed .info {
  border: 0;
  overflow: hidden;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
}

.sidebar {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: block;
  width: min(190px, 100%);
  height: auto;
  margin: 0 0 16px;
  border-radius: 0;
  background: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
}

.brand p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.slide-list {
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slide-tab {
  width: 100%;
  min-height: 46px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: start;
}

.slide-tab:hover {
  background: rgba(0, 56, 200, .08);
  color: var(--ink);
}

.slide-tab.active {
  background: #e8f2ff;
  border-color: rgba(0, 56, 200, .32);
  color: var(--ink);
}

.slide-tab .num {
  color: var(--purple);
  font-weight: 700;
  font-size: 12px;
}

.slide-tab .name {
  font-size: 13px;
  line-height: 1.35;
}

.stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 255, .72);
}

.topbar-title {
  flex: 1 1 150px;
  min-width: 0;
}

.topbar-title strong {
  display: block;
  font-size: 19px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn,
.text-btn {
  border: 1px solid rgba(0, 56, 200, .28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .76);
  color: var(--ink);
  min-height: 40px;
  padding: 0 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 38, 120, .08);
}

.icon-btn {
  width: 42px;
  font-size: 24px;
  line-height: 1;
}

.text-btn.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  font-weight: 700;
}

.panel-toggle {
  min-width: 78px;
  color: var(--purple);
  font-weight: 700;
}

.icon-btn:disabled,
.text-btn:disabled {
  cursor: default;
  opacity: .42;
  box-shadow: none;
}

.text-btn:not(:disabled):hover,
.icon-btn:not(:disabled):hover {
  background: #f1e8fa;
}

.text-btn.primary:not(:disabled):hover { background: #0025a8; }

.slide-frame {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 26px;
}

.slide-frame::before {
  content: "";
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
  border: 1px dashed rgba(0, 56, 200, .2);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 56, 200, .08), rgba(255, 255, 255, .56)),
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(0, 56, 200, .035) 32px);
  box-shadow: var(--shadow);
  display: none;
}

.slide-frame.is-missing::before { display: block; }

.slide-frame.is-missing img { display: none; }

.slide-frame.is-video::before,
.slide-frame.is-video img { display: none; }

.slide-frame img {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #f6fbff;
}

.slide-video {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #0e1726;
}

.slide-video[hidden] { display: none; }

.slide-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.info {
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 22px;
}

.info h2 {
  margin: 0 0 8px;
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: 0;
}

.core {
  margin: 0 0 16px;
  color: var(--purple);
  font-weight: 700;
  line-height: 1.55;
}

.block {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.block[hidden] { display: none; }

.block h3 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 14px;
  line-height: 1.4;
}

.block ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.7;
}

.block li {
  margin-bottom: 12px;
  padding-left: 2px;
}

.block li:last-child { margin-bottom: 0; }

.block li::marker {
  color: var(--purple);
  font-weight: 700;
}

.block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.share-text {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 600;
}

.links {
  display: grid;
  gap: 8px;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.link-row a {
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: rgba(255, 255, 255, .7);
  overflow-wrap: anywhere;
}

.link-row a:hover { background: #f1e8fa; }

.copy-link {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  color: var(--purple);
  cursor: pointer;
}

.cover-card {
  display: none;
  margin: 16px 0 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f6fbff;
}

.cover-card.active {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  align-items: center;
}

.qr-button {
  width: 100px;
  height: 100px;
  border: 1px solid rgba(0, 56, 200, .24);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.qr-button img,
#qrcodeLarge img {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-text {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.qr-text strong {
  color: var(--ink);
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(34, 26, 47, .68);
}

.modal[hidden] { display: none; }

.modal-box {
  position: relative;
  width: min(92vw, 430px);
  text-align: center;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 30px 28px 26px;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f2edf8;
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

#qrcodeLarge {
  display: grid;
  place-items: center;
  width: 260px;
  height: 260px;
  margin: 0 auto 16px;
}

.modal-box p {
  margin: 10px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 45;
  transform: translate(-50%, 120%);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-menu { display: none; }

@media (max-width: 1120px) {
  body { overflow: auto; }

  .app {
    display: block;
    min-height: 100vh;
    height: auto;
  }

  .sidebar { display: none; }

  .sidebar-toggle { display: none; }

  .app.info-collapsed .info { display: none; }

  .mobile-menu {
    display: block;
    width: 100%;
    min-height: 42px;
    margin-top: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .88);
    color: var(--ink);
    padding: 9px 10px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    min-height: 0;
    flex-wrap: wrap;
    background: rgba(251, 247, 255, .94);
    backdrop-filter: blur(14px);
  }

  .topbar-title { width: 100%; }

  .topbar-title strong { white-space: normal; }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .slide-frame {
    min-height: auto;
    padding: 16px;
  }

  .slide-frame img,
  .slide-video,
  .slide-frame::before {
    width: 100%;
    max-height: none;
  }

  .info {
    border-left: 0;
    border-top: 1px solid var(--line);
    background: var(--paper);
  }

  .app.is-presentation {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: auto;
  }

  .app.is-presentation .stage {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .topbar { padding: 12px; }

  .topbar-title strong { font-size: 17px; }

  .nav {
    display: grid;
    grid-template-columns: 42px repeat(4, minmax(50px, 1fr)) 42px;
    gap: 6px;
  }

  .text-btn {
    min-width: 0;
    padding: 0 4px;
    font-size: 12px;
  }

  .info { padding: 18px 16px 28px; }

  .info h2 { font-size: 21px; }

  .cover-card.active { grid-template-columns: 1fr; }

  .qr-button {
    width: 116px;
    height: 116px;
  }
}

