:root {
  --bg: #f6f4ef;
  --bg-alt: #efece4;
  --ink: #1a1b2e;
  --ink-soft: #4a4d66;
  --ink-muted: #7d7f96;
  --line: #e5e1d5;
  --line-soft: #efece4;
  --brand: #10b981;
  --brand-soft: #d1fae5;
  --brand-ink: #047857;
  --accent: #ff7a59;
  --accent-soft: #ffe7de;
  --ok: #2f9e6f;
  --warn: #c37a0a;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 18, 50, 0.04), 0 1px 3px rgba(20, 18, 50, 0.06);
  --shadow-md: 0 4px 12px rgba(20, 18, 50, 0.06), 0 12px 30px rgba(20, 18, 50, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 18, 50, 0.18);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 85% -10%, #d1fae5 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #ffe7de 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.hidden { display: none !important; }

/* ---------- Auth overlay ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(600px 400px at 80% 20%, rgba(16, 185, 129, 0.18), transparent 60%),
    radial-gradient(500px 400px at 20% 80%, rgba(255, 122, 89, 0.18), transparent 60%),
    #0e0d1f;
  z-index: 100;
  animation: fadeIn 0.5s var(--ease);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-lg);
  padding: 44px 36px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: cardIn 0.6s var(--ease);
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(16,185,129,0.35), rgba(255,122,89,0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.auth-logo {
  width: 96px; height: 96px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  filter: drop-shadow(0 12px 28px rgba(20, 18, 50, 0.18));
  animation: logoFloat 6s var(--ease) infinite alternate;
}
.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-title {
  font-family: "Fraunces", serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.15;
}
.auth-title .plus { color: var(--brand); }
.auth-title-sub {
  display: block;
  font-size: 0.65em;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 2px;
}

.auth-subtitle {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.auth-form { display: grid; gap: 14px; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input-icon {
  position: absolute;
  left: 16px;
  color: var(--ink-muted);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding: 14px 48px 14px 44px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.input-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
}

.toggle-pw {
  position: absolute;
  right: 8px;
  background: none;
  border: 0;
  color: var(--ink-muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
}
.toggle-pw:hover { color: var(--ink); background: var(--bg-alt); }

.btn-primary {
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(16,185,129,0.3);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(16,185,129,0.35); }
.btn-primary:active { transform: translateY(0); filter: brightness(0.95); }

.auth-error {
  margin: 4px 0 0;
  min-height: 20px;
  font-size: 13px;
  color: #d63757;
  font-weight: 500;
}

.auth-hint {
  margin: 22px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.auth-card.shake { animation: shake 0.45s var(--ease); }

/* ---------- App ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }

.hero {
  position: relative;
  padding: 56px 32px 80px;
  overflow: hidden;
}
.hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.hero-brand { max-width: 760px; }

.hero-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 8px 20px rgba(20, 18, 50, 0.14));
}
.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.hero-badge {
  display: inline-block;
  padding: 6px 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.hero-title {
  font-family: "Fraunces", serif;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 14px;
}
.hero-title .plus { color: var(--brand); }
.hero-title .hero-sub {
  display: block;
  font-size: 0.55em;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.hero-lead {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0;
}

.hero-glow {
  position: absolute;
  inset: auto -10% -60% auto;
  width: 60%;
  height: 120%;
  background: radial-gradient(closest-side, rgba(16,185,129,0.12), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); background: #fff; }

/* ---------- Main / Toolbar ---------- */
.main {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px 64px;
}

.toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--bg-alt);
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.search-wrap input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.1);
}

.toolbar-actions { display: flex; gap: 8px; }

.btn-tool {
  padding: 10px 14px;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-tool:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }

/* ---------- Sections ---------- */
.section-wrap { margin-top: 8px; }

.section-title {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
.section-desc {
  margin: 0 0 24px;
  color: var(--ink-muted);
  font-size: 14.5px;
}

.panels { display: grid; gap: 12px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.panel:hover { border-color: #d9d3bf; box-shadow: var(--shadow-md); }
.panel.is-open { border-color: #a7f3d0; box-shadow: var(--shadow-md); }

.panel-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.panel-index {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.panel-title {
  flex: 1;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink);
  margin: 0;
  line-height: 1.4;
}

.panel-meta {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--ink-muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
}

.chev {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--ink-muted);
  transition: transform 0.3s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.panel.is-open .chev { transform: rotate(180deg); color: var(--brand-ink); background: var(--brand-soft); }

.panel-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s var(--ease);
}
.panel.is-open .panel-body { grid-template-rows: 1fr; }

.panel-body-inner {
  overflow: hidden;
  min-height: 0;
}

.items {
  list-style: none;
  margin: 0;
  padding: 4px 14px 14px;
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
}
.panel.is-open .items { padding-top: 14px; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.item:hover {
  background: var(--bg-alt);
  border-color: var(--line);
}
.item:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.item-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.item-icon.pptx  { background: #ffe7de; color: #b63a12; }
.item-icon.video { background: #e2f4ff; color: #0a6bb3; }
.item-icon.image { background: #e6f7ec; color: #1e7a4a; }
.item-icon.qr    { background: #cffafe; color: #0e7490; }
.item-icon.muted { background: var(--bg-alt); color: var(--ink-muted); }

.item-body { flex: 1; min-width: 0; }
.item-title {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.item-tag {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.item-tag.pptx  { background: #ffe7de; color: #b63a12; }
.item-tag.video { background: #e2f4ff; color: #0a6bb3; }
.item-tag.image { background: #e6f7ec; color: #1e7a4a; }
.item-tag.qr    { background: #cffafe; color: #0e7490; }
.item-tag.muted { background: var(--bg-alt); color: var(--ink-muted); }

.item.is-disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
.item.is-disabled:hover { background: transparent; border-color: transparent; }

.panel.hidden { display: none; }

.empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 32px;
  font-size: 14.5px;
}

/* ---------- Video modal ---------- */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 0.2s var(--ease);
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 25, 0.72);
  backdrop-filter: blur(6px);
}
.video-modal-panel {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: #0e0d1f;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cardIn 0.3s var(--ease);
}
.video-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: #fff;
  background: rgba(255,255,255,0.04);
}
.video-modal-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-modal-close {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.video-modal-close:hover { background: rgba(255,255,255,0.16); }
.video-modal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 18px;
  background: rgba(255,255,255,0.04);
}
.btn-yt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #ff0033;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: filter 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn-yt:hover { filter: brightness(1.1); transform: translateY(-1px); }

body.modal-open { overflow: hidden; }

/* ---------- Footer ---------- */
.footer {
  padding: 28px 32px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
@keyframes logoFloat {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .hero { padding: 36px 20px 60px; }
  .hero-inner { flex-direction: column; align-items: flex-start; }
  .hero-logo { width: 52px; height: 52px; margin-bottom: 14px; }
  #logout {
    position: absolute;
    top: 20px;
    right: 20px;
  }
  .main { padding: 0 20px 48px; }
  .toolbar { padding: 12px; }
  .panel-header { padding: 16px; gap: 12px; }
  .panel-title { font-size: 14.5px; }
  .panel-meta { display: none; }
  .item { padding: 10px 12px; }
  .item-icon { width: 34px; height: 34px; }
  .item-tag { display: none; }
}
