/* ============================================================
   USER PROVIDED CSS (For Picker/UI)
   ============================================================ */
:root {
  --bg:            #fafafa;
  --bg-surface:    #f2f2f2;
  --bg-card:       #ececec;
  --bg-elevated:   #e2e2e2;
  --border:        rgba(0,0,0,0.07);
  --text-primary:  #0d0d0d;
  --text-secondary:#555;
  --text-muted:    #999;
  --accent:        #1a1a1a;
  --accent-text:   #fff;
  --tonal-bg:      #e5e5e5;
  --tonal-text:    #1a1a1a;
  --nav-bg:        rgba(248,248,248,0.90);
  --nav-active:    #0d0d0d;
  --nav-inactive:  #bbb;
  --ok:            #18a058;
  --ok-text:       #fff;
  --shadow-s:      0 1px 6px rgba(0,0,0,0.06), 0 2px 16px rgba(0,0,0,0.04);
  --shadow-m:      0 4px 28px rgba(0,0,0,0.09), 0 1px 8px rgba(0,0,0,0.05);
  --r-xl: 26px; --r-l: 20px; --r-m: 14px; --r-s: 8px;
  --ease: cubic-bezier(0.22,1,0.36,1);
  --dur:  0.26s;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body:    'Outfit', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0d0d0d;
    --bg-surface:    #161616;
    --bg-card:       #1e1e1e;
    --bg-elevated:   #282828;
    --border:        rgba(255,255,255,0.07);
    --text-primary:  #f0f0f0;
    --text-secondary:#909090;
    --text-muted:    #555;
    --accent:        #f0f0f0;
    --accent-text:   #0d0d0d;
    --tonal-bg:      #252525;
    --tonal-text:    #f0f0f0;
    --nav-bg:        rgba(14,14,14,0.92);
    --nav-active:    #f0f0f0;
    --nav-inactive:  #555;
    --shadow-s:      0 1px 6px rgba(0,0,0,0.4), 0 2px 16px rgba(0,0,0,0.3);
    --shadow-m:      0 4px 28px rgba(0,0,0,0.55), 0 1px 8px rgba(0,0,0,0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* ============================================================
   Presentation App Specific CSS
   ============================================================ */

/* Screens */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
}
.screen.active {
    display: flex;
    flex-direction: column;
}

/* Mobile Warning */
#mobile-warning {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}
#mobile-warning .info-card {
    max-width: 400px;
}

/* Selector Screen */
#selector-screen {
    padding: 20px;
    overflow-y: auto;
}
.top-bar {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px 12px;
    display: flex; align-items: center; gap: 10px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: -20px -20px 20px -20px;
}
.top-bar-logo {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--text-primary);
    flex: 1;
}

#search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    margin-bottom: 20px;
    font-family: var(--font-body);
    transition: border-color var(--dur) var(--ease);
}
#search-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

.card {
    background: var(--bg-card);
    border-radius: var(--r-l);
    padding: 18px 20px;
    border: 1px solid var(--border);
    transition: background var(--dur) var(--ease), transform 0.14s;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.card:active { transform: scale(0.985); }
.card:hover { background: var(--bg-elevated); }
.card-number {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-muted);
    width: 50px;
    flex-shrink: 0;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Settings Menu */
#settings-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 24px;
    box-shadow: var(--shadow-m);
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.4s var(--ease);
    z-index: 101;
    color: var(--text-primary);
}
#settings-menu.open {
    transform: translateY(0);
    opacity: 1;
}
#settings-menu h3 {
    margin-bottom: 20px;
    font-family: var(--font-display);
    font-size: 22px;
}
.setting-group { margin-bottom: 16px; }
.setting-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.setting-group select {
    width: 100%;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--r-s);
    font-family: inherit;
    outline: none;
}
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-container input[type="range"] {
    flex-grow: 1;
    accent-color: var(--accent);
}
.slider-container span {
    min-width: 45px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}
.btn {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    padding: 12px 22px;
    border-radius: var(--r-l);
    border: none; cursor: pointer;
    font-family: var(--font-body);
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    transition: transform 0.13s, box-shadow var(--dur) var(--ease);
    width: 100%;
    margin-top: 10px;
}
.btn-filled {
    background: var(--accent);
    color: var(--accent-text);
}
.btn-filled:active { transform: scale(0.97); }

/* Presentation Screen Specifics */
:root {
    --pres-bg: #000000;
    --pres-color: #ffffff;
    --pres-font: 'Outfit', sans-serif;
    --pres-size: 70px;
    --pres-margin: 10%;
    --pres-align: center;
}
[data-theme="amoled"] { --pres-bg: #000000; --pres-color: #ffffff; }
[data-theme="dark"] { --pres-bg: #111111; --pres-color: #ffffff; }
[data-theme="light"] { --pres-bg: #f5f5f5; --pres-color: #111111; }
[data-theme="blue"] { --pres-bg: #001220; --pres-color: #ffffff; }

#presentation-screen {
    background-color: var(--pres-bg) !important;
    color: var(--pres-color) !important;
    position: relative;
    overflow: hidden;
}

/* Settings Trigger Area (Bottom Right) */
#settings-trigger {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 100px;
    z-index: 100;
    /* invisible trigger area */
}

#slide-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* The actual text container inside the slide */
.slide-content-wrapper {
    width: 100%;
    max-width: var(--pres-width);
    height: 100%;
    margin: 0 auto;
    padding: var(--pres-margin); /* Use padding for margins */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: var(--pres-align);
    text-align: var(--pres-align);
    box-sizing: border-box;
}

.slide-text {
    font-family: var(--pres-font);
    font-size: var(--pres-size);
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word; /* Prevent text going off-screen horizontally */
    width: 100%;
    height: 100%; /* Match parent height to avoid overflow downwards unconstrained */
    position: absolute;
    top: 0; left: 0;
    box-sizing: border-box;
}
.slide-text.title-slide .slide-content-wrapper {
    font-weight: bold;
    font-size: calc(var(--pres-size) * 1.2);
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Transitions */
.slide-text.fade-enter { opacity: 0; }
.slide-text.fade-enter-active { opacity: 1; transition: opacity 0.5s ease-in-out; }
.slide-text.fade-exit { opacity: 1; }
.slide-text.fade-exit-active { opacity: 0; transition: opacity 0.5s ease-in-out; }

.slide-text.slide-enter { transform: translateY(100%); opacity: 0; }
.slide-text.slide-enter-active { transform: translateY(0); opacity: 1; transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); }
.slide-text.slide-exit { transform: translateY(0); opacity: 1; }
.slide-text.slide-exit-active { transform: translateY(-100%); opacity: 0; transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); }

.slide-text.zoom-enter { transform: scale(0.8); opacity: 0; }
.slide-text.zoom-enter-active { transform: scale(1); opacity: 1; transition: all 0.5s ease; }
.slide-text.zoom-exit { transform: scale(1); opacity: 1; }
.slide-text.zoom-exit-active { transform: scale(1.2); opacity: 0; transition: all 0.5s ease; }

.slide-text.none-enter-active, .slide-text.none-exit-active { transition: none; }
