/* =========== THEME VARIABLES =========== */
:root {
    --accent: #818cf8;
    --accent-light: #a78bfa;
    --accent-rgb: 129, 140, 248;
    --accent-glow: rgba(129, 140, 248, 0.3);
    --gradient: linear-gradient(135deg, var(--accent), var(--accent-light));
}

html {
    transition: --accent 1.5s, --accent-light 1.5s;
}

/* =========== RESET =========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: color 1.5s ease, border-color 1.5s ease, box-shadow 1.5s ease;
}

html {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* =========== BODY =========== */
body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background: #0a0f1e;
    color: #e2e8f0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    overflow-x: hidden;
    position: relative;
}

/* Animated mesh gradient background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
    animation: blobFloat 10s ease-in-out infinite alternate;
}

.bg-blob.b1 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -10%;
    left: -5%;
    animation-duration: 12s;
}

.bg-blob.b2 {
    width: 350px;
    height: 350px;
    background: var(--accent-light);
    bottom: -10%;
    right: -5%;
    animation-duration: 14s;
    animation-delay: -4s;
}

.bg-blob.b3 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    top: 40%;
    left: 50%;
    animation-duration: 10s;
    animation-delay: -2s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -20px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 30px) scale(0.95);
    }

    100% {
        transform: translate(15px, 15px) scale(1.05);
    }
}

/* =========== WRAPPER =========== */
.wrapper {
    width: 100%;
    max-width: 520px;
    padding-bottom: 40px;
    position: relative;
    z-index: 1;
}

/* =========== HEADER =========== */
.logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo h1 {
    font-size: 26px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo p {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* =========== CARD (Glass) =========== */
.card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease, color 1.5s ease, border-color 1.5s ease;
}

.card:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

/* =========== SECTION LABELS =========== */
.section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =========== DIVIDER =========== */
.hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #334155, transparent);
    margin: 20px 0;
}

/* =========== FORM ELEMENTS =========== */
.field {
    margin-bottom: 14px;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    color: #e2e8f0;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.12);
}

.field input::placeholder {
    color: #475569;
}

.field select option {
    background: #1e293b;
}

/* Two columns */
.row {
    display: flex;
    gap: 12px;
}

.row .field {
    flex: 1;
}

/* =========== SUBMIT BUTTON =========== */
.btn-submit {
    width: 100%;
    padding: 13px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    background: var(--gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-submit:hover {
    opacity: 0.92;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* =========== ERROR =========== */
.error {
    display: none;
    background: rgba(69, 26, 26, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid #7f1d1d;
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 12px;
}

/* =========== NAME ROW =========== */
.name-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.name-row .field {
    flex: 1;
    margin-bottom: 0;
}

.btn-gen {
    padding: 11px 14px;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.5);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 14px;
}

.btn-gen:hover {
    background: rgba(51, 65, 85, 0.6);
    border-color: var(--accent);
}

/* =========== BATCH ENTRIES =========== */
.batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.batch-count {
    background: var(--gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    margin-left: 8px;
}

.btn-add {
    padding: 8px 16px;
    border: 1px dashed rgba(var(--accent-rgb), 0.5);
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-add:hover {
    background: rgba(var(--accent-rgb), 0.08);
    border-color: var(--accent);
}

.entries-container {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
}

/* =========== ENTRY CARD (Glass) =========== */
.entry-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    animation: slideIn 0.2s ease;
    backdrop-filter: blur(8px);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Collapsible header */
.entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.entry-header:hover {
    background: rgba(var(--accent-rgb), 0.04);
}

.entry-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.entry-header .entry-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.entry-header .entry-preview {
    font-size: 12px;
    color: #64748b;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.entry-card .btn-remove {
    border: none;
    background: rgba(127, 29, 29, 0.7);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
}

.entry-card .btn-remove:hover {
    background: rgba(153, 27, 27, 0.8);
}

.chevron {
    font-size: 14px;
    color: #64748b;
    transition: transform 0.2s;
}

.entry-card.collapsed .chevron {
    transform: rotate(-90deg);
}

/* Collapsible body */
.entry-body {
    padding: 0 16px 16px;
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.entry-card.collapsed .entry-body {
    max-height: 0;
    padding: 0 16px;
}

.entry-card .field {
    margin-bottom: 10px;
}

.entry-card .field label {
    font-size: 11px;
    margin-bottom: 4px;
}

.entry-card .field input,
.entry-card .field select {
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.entry-card .row {
    gap: 8px;
}

.entry-card .name-row {
    gap: 6px;
}

.entry-card .btn-gen {
    padding: 9px 10px;
    font-size: 11px;
    margin-bottom: 10px;
}

/* Date/Time Panel — Modern collapsible */
.time-panel {
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.3);
    transition: border-color 0.2s;
}

.time-panel:hover,
.time-panel.time-panel-open {
    border-color: rgba(var(--accent-rgb), 0.3);
}

.time-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.time-panel-header:hover {
    background: rgba(var(--accent-rgb), 0.04);
}

.time-panel-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.time-icon {
    font-size: 14px;
}

.time-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.3px;
}

.time-badge {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: var(--gradient);
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-toggle-hint {
    font-size: 10px;
    color: #475569;
    font-style: italic;
    white-space: nowrap;
}

.time-chevron {
    font-size: 11px;
}

.time-panel:not(.time-panel-open) .time-chevron {
    transform: rotate(-90deg);
}

.time-panel-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 12px;
}

.time-panel.time-panel-open .time-panel-body {
    max-height: 350px;
    padding: 0 12px 12px;
}

/* Preset quick-set buttons */
.time-presets {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.time-preset-btn {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.4);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.time-preset-btn:hover {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent);
    color: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.15);
}

.time-preset-btn:active {
    transform: scale(0.96);
}

/* Date + Time inputs row */
.time-inputs-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.time-inputs-row .field {
    flex: 1;
    margin-bottom: 0;
}

.time-inputs-row input[type="date"],
.time-inputs-row input[type="time"] {
    color-scheme: dark;
}

/* 12-hour time picker group */
.time-12h-group {
    flex: 1.3;
}

.time-12h-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 6px;
}

.time-12h-selects {
    display: flex;
    align-items: center;
    gap: 3px;
}

.time-12h-selects select {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.time-12h-selects select:focus {
    outline: none;
    border-color: var(--accent);
}

.time-colon {
    color: #64748b;
    font-weight: 700;
    font-size: 16px;
}

.time-clear-btn {
    padding: 0 10px;
    border: 1px solid rgba(127, 29, 29, 0.5);
    border-radius: 8px;
    background: rgba(69, 26, 26, 0.4);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 22px;
    height: 37px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.time-clear-btn:hover {
    background: rgba(127, 29, 29, 0.6);
    border-color: #991b1b;
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: #475569;
    font-size: 13px;
}

/* =========== LOADING OVERLAY =========== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 30, 0.96);
    backdrop-filter: blur(12px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
}

.loading-overlay.active {
    display: flex;
}

/* Candle chart loader */
.candle-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: transparent;
}

.candle-chart {
    display: flex;
    align-items: flex-end;
    height: 80px;
    gap: 4px;
}

.candle {
    width: 6px;
    height: 110%;
    position: relative;
    animation: fade 2.6s infinite ease-in-out;
    filter: drop-shadow(0 0 2.7px #fff);
}

.candle::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #fff;
    bottom: var(--b);
    height: var(--h);
}

.candle::before {
    content: "";
    position: absolute;
    left: 63%;
    transform: translateX(-50%);
    width: 1px;
    background: #fff;
    bottom: var(--wb);
    height: var(--wh);
}

.candle:nth-child(1) {
    --b: 7.1%;
    --h: 18.93%;
    --wb: 0%;
    --wh: 31.95%;
    animation-delay: 0s;
}

.candle:nth-child(2) {
    --b: 26.04%;
    --h: 2.37%;
    --wb: 19.41%;
    --wh: 14.91%;
    animation-delay: 0.065s;
}

.candle:nth-child(3) {
    --b: 28.64%;
    --h: 4.5%;
    --wb: 16.92%;
    --wh: 21.66%;
    animation-delay: 0.13s;
}

.candle:nth-child(4) {
    --b: 31.42%;
    --h: 3.43%;
    --wb: 19.76%;
    --wh: 27.93%;
    animation-delay: 0.195s;
}

.candle:nth-child(5) {
    --b: 31.42%;
    --h: 15.44%;
    --wb: 27.43%;
    --wh: 28.07%;
    animation-delay: 0.26s;
}

.candle:nth-child(6) {
    --b: 46.54%;
    --h: 0.28%;
    --wb: 43.43%;
    --wh: 24.38%;
    animation-delay: 0.325s;
}

.candle:nth-child(7) {
    --b: 35.86%;
    --h: 8.7%;
    --wb: 29.7%;
    --wh: 24.5%;
    animation-delay: 0.39s;
}

.candle:nth-child(8) {
    --b: 11.67%;
    --h: 24.19%;
    --wb: 5.33%;
    --wh: 31.83%;
    animation-delay: 0.455s;
}

.candle:nth-child(9) {
    --b: 11.83%;
    --h: 15.1%;
    --wb: 7.93%;
    --wh: 24.97%;
    animation-delay: 0.52s;
}

.candle:nth-child(10) {
    --b: 27.81%;
    --h: 12.04%;
    --wb: 27.69%;
    --wh: 28.17%;
    animation-delay: 0.585s;
}

.candle:nth-child(11) {
    --b: 39.85%;
    --h: 28.25%;
    --wb: 39.53%;
    --wh: 28.58%;
    animation-delay: 0.65s;
}

.candle:nth-child(12) {
    --b: 70.8%;
    --h: 6.27%;
    --wb: 60.96%;
    --wh: 24.84%;
    animation-delay: 0.715s;
}

.candle:nth-child(13) {
    --b: 75.8%;
    --h: 2.71%;
    --wb: 68.38%;
    --wh: 31.62%;
    animation-delay: 0.78s;
}

.candle:nth-child(14) {
    --b: 67.23%;
    --h: 8.71%;
    --wb: 64.8%;
    --wh: 24.97%;
    animation-delay: 0.845s;
}

.candle:nth-child(15) {
    --b: 67.81%;
    --h: 7.85%;
    --wb: 57.54%;
    --wh: 27.55%;
    animation-delay: 0.91s;
}

.candle:nth-child(16) {
    --b: 70.08%;
    --h: 6.14%;
    --wb: 55.68%;
    --wh: 21.83%;
    animation-delay: 0.975s;
}

.candle:nth-child(17) {
    --b: 66.39%;
    --h: 3.69%;
    --wb: 58.11%;
    --wh: 26.11%;
    animation-delay: 1.04s;
}

.candle:nth-child(18) {
    --b: 64.8%;
    --h: 9.78%;
    --wb: 45.47%;
    --wh: 29.61%;
    animation-delay: 1.105s;
}

@keyframes fade {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }

    10% {
        opacity: 1;
        transform: scaleY(1.5);
    }

    50% {
        opacity: 1;
        transform: scaleY(1.35);
    }

    70% {
        opacity: 0;
        transform: scaleY(1.5);
    }

    100% {
        opacity: 0;
        transform: scaleY(0);
    }
}

.loader-pct {
    font-size: 22px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.loader-text {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
}

.loader-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

.loader-counter {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* =========== GALLERY =========== */
.gallery {
    display: none;
    margin-top: 20px;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.gallery-header .section {
    margin-bottom: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.gallery-item {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    overflow: hidden;
    animation: slideIn 0.3s ease;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.gallery-item:active {
    transform: scale(0.97);
}

.gallery-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.15);
}

.gallery-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.gallery-item-header .gi-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.gallery-item-header .btn-dl-single {
    padding: 3px 8px;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.gallery-item-header .btn-dl-single:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
}

.gallery-item .gallery-thumb {
    width: 100%;
    display: block;
    aspect-ratio: auto;
}

/* =========== LIGHTBOX =========== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(16px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 1001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.lightbox-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-dl {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.lightbox-dl:hover {
    opacity: 0.9;
}

.lightbox-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 10px;
    font-weight: 500;
}

/* =========== GALLERY BUTTONS =========== */
.gallery-btns {
    display: flex;
    gap: 10px;
}

.btn-dl-all,
.btn-new-batch {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn-dl-all {
    background: rgba(6, 78, 59, 0.7);
    color: #34d399;
    border: 1px solid rgba(6, 95, 70, 0.6);
    backdrop-filter: blur(4px);
}

.btn-dl-all:hover {
    background: rgba(6, 95, 70, 0.8);
}

.btn-new-batch {
    background: rgba(30, 41, 59, 0.5);
    color: #94a3b8;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.btn-new-batch:hover {
    background: rgba(51, 65, 85, 0.6);
    color: #e2e8f0;
}

/* =========== SPINNER =========== */
.spin {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rotate 0.5s linear infinite;
    margin: 0 auto;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

/* =========== COMMON SENDER (Glass) =========== */
.common-sender {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
    backdrop-filter: blur(8px);
}

.common-sender:not(.collapsed) {
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3), 0 0 24px rgba(16, 185, 129, 0.1);
}

.common-sender.collapsed.configured {
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.common-sender-header .cs-preview {
    font-size: 11px;
    color: #10b981;
    margin-left: 10px;
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.common-sender-header .cs-badge {
    font-size: 9px;
    font-weight: 700;
    background: #10b981;
    color: #0f172a;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.common-sender-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.common-sender-header:hover {
    background: rgba(var(--accent-rgb), 0.04);
}

.common-sender-header .cs-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.common-sender-header .chevron {
    font-size: 14px;
    color: #64748b;
    transition: transform 0.2s;
}

.common-sender.collapsed .common-sender-header .chevron {
    transform: rotate(-90deg);
}

.common-sender-fields {
    padding: 0 16px 16px;
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.common-sender.collapsed .common-sender-fields {
    max-height: 0;
    padding: 0 16px;
}

.common-sender-fields .field {
    margin-bottom: 10px;
}

.common-sender-fields .name-row {
    gap: 6px;
}

/* =========== SCROLLBAR =========== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* =========== NAVIGATION LINKS =========== */
.btn-history-link,
.back-link {
    display: block;
    text-align: center;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.btn-history-link:hover,
.back-link:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: var(--accent);
}

/* =========== ENTRY CARD COLORS =========== */
.entry-card.color-0 {
    border-left: 3px solid #818cf8;
}

.entry-card.color-1 {
    border-left: 3px solid #34d399;
}

.entry-card.color-2 {
    border-left: 3px solid #fb7185;
}

.entry-card.color-3 {
    border-left: 3px solid #fbbf24;
}

.entry-card.color-4 {
    border-left: 3px solid #22d3ee;
}

.entry-card.color-5 {
    border-left: 3px solid #c084fc;
}

.entry-card.color-0 .entry-num {
    color: #818cf8;
}

.entry-card.color-1 .entry-num {
    color: #34d399;
}

.entry-card.color-2 .entry-num {
    color: #fb7185;
}

.entry-card.color-3 .entry-num {
    color: #fbbf24;
}

.entry-card.color-4 .entry-num {
    color: #22d3ee;
}

.entry-card.color-5 .entry-num {
    color: #c084fc;
}

/* =========== HISTORY PANEL =========== */
.history-panel {
    margin-top: 20px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.history-header .section {
    margin-bottom: 0;
}

.btn-clear-history {
    padding: 5px 12px;
    border: 1px solid rgba(127, 29, 29, 0.5);
    border-radius: 8px;
    background: transparent;
    color: #fca5a5;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-clear-history:hover {
    background: rgba(127, 29, 29, 0.3);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(8px);
    transition: border-color 0.2s;
}

.history-item:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
}

.history-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-meta .h-count {
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
}

.history-meta .h-time {
    font-size: 11px;
    color: #64748b;
}

.history-actions {
    display: flex;
    gap: 6px;
}

.history-actions button {
    padding: 5px 10px;
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.history-actions button:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: #475569;
    font-size: 12px;
}

/* =========== CONFIRM MODAL =========== */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.active {
    display: flex;
}

.confirm-box {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 18px;
    padding: 28px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    animation: slideIn 0.2s ease;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.confirm-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.confirm-msg {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 20px;
}

.confirm-btns {
    display: flex;
    gap: 10px;
}

.confirm-cancel {
    flex: 1;
    padding: 11px;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-cancel:hover {
    background: rgba(51, 65, 85, 0.4);
}

.confirm-delete {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.confirm-delete:hover {
    opacity: 0.9;
}

/* =========== FOOTER =========== */
.app-footer {
    text-align: center;
    margin-top: 28px;
    padding: 24px 0 12px;
}

.footer-credit {
    font-size: 14px;
    color: rgba(148, 163, 184, 0.7);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

.footer-heart {
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.5));
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.footer-link {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.4), 0 0 20px rgba(var(--accent-rgb), 0.2);
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: #fff;
    text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.6), 0 0 24px rgba(var(--accent-rgb), 0.4), 0 0 40px rgba(var(--accent-rgb), 0.2);
}

/* =========== MOBILE OPTIMIZATION =========== */
@media (max-width: 480px) {
    body {
        padding: 10px;
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    .wrapper {
        padding-bottom: 24px;
        max-width: 100%;
    }

    .logo {
        margin-bottom: 16px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .logo p {
        font-size: 12px;
    }

    /* ---- Card tighter padding ---- */
    .card {
        padding: 14px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    /* ---- Section labels ---- */
    .section {
        font-size: 10px;
        letter-spacing: 1px;
        margin-bottom: 10px;
    }

    /* ---- Batch header ---- */
    .batch-header {
        margin-bottom: 10px;
        gap: 8px;
    }

    /* ---- Form fields ---- */
    .field {
        margin-bottom: 10px;
    }

    .field label {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .field input {
        padding: 12px;
        min-height: 44px;
        font-size: 15px;
    }

    .field select {
        padding: 12px;
        font-size: 15px;
        min-height: 44px;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
    }

    /* ---- Row layout — keep side by side but tighter ---- */
    .row {
        gap: 8px;
    }

    /* ---- Name row fix: input + dice button alignment ---- */
    .name-row {
        gap: 6px;
        align-items: flex-end;
    }

    .name-row .field {
        flex: 1;
        min-width: 0;
    }

    .btn-gen {
        padding: 12px;
        min-height: 44px;
        min-width: 44px;
        font-size: 14px;
        flex-shrink: 0;
    }

    /* ---- Common sender drawer ---- */
    .common-sender-header {
        padding: 10px 12px;
    }

    .common-sender-header .cs-label {
        font-size: 12px;
    }

    .common-sender-header .cs-preview {
        max-width: 120px;
        font-size: 10px;
    }

    .common-sender-fields {
        padding: 0 12px 12px;
    }

    .common-sender.collapsed .common-sender-fields {
        padding: 0 12px;
    }

    .common-sender-fields .field {
        margin-bottom: 8px;
    }

    /* ---- Time panel mobile ---- */
    .time-panel-header {
        padding: 8px 10px;
        gap: 6px;
    }

    .time-label {
        font-size: 10px;
    }

    .time-toggle-hint {
        font-size: 9px;
    }

    .time-badge {
        font-size: 8px;
        padding: 2px 6px;
        max-width: 120px;
    }

    /* ---- Time presets: 2x2 grid on mobile ---- */
    .time-presets {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .time-preset-btn {
        padding: 8px 6px;
        font-size: 10px;
        min-height: 36px;
    }

    /* ---- Time inputs: STACK vertically on mobile ---- */
    .time-inputs-row {
        flex-direction: column;
        gap: 8px;
    }

    .time-inputs-row .field {
        width: 100%;
        margin-bottom: 0;
    }

    .time-12h-group {
        width: 100%;
        flex: unset;
    }

    .time-12h-selects {
        gap: 4px;
    }

    .time-12h-selects select {
        padding: 10px 6px;
        font-size: 14px;
        min-height: 42px;
    }

    .time-clear-btn {
        width: 100%;
        justify-content: center;
        margin-top: 6px;
        height: 38px;
        font-size: 12px;
    }

    .time-panel.time-panel-open .time-panel-body {
        max-height: 400px;
        padding: 0 10px 10px;
    }

    .time-panel-body {
        padding: 0 10px;
    }

    /* ---- Entry cards ---- */
    .entry-header {
        padding: 10px 12px;
    }

    .entry-body {
        padding: 0 12px 12px;
    }

    .entry-card.collapsed .entry-body {
        padding: 0 12px;
    }

    .entry-card .field input,
    .entry-card .field select {
        padding: 10px;
        font-size: 14px;
    }

    .entry-card .btn-gen {
        padding: 10px;
        min-height: 42px;
        min-width: 42px;
    }

    .entry-header .entry-preview {
        max-width: 120px;
        font-size: 11px;
    }

    /* ---- Buttons ---- */
    .btn-submit {
        padding: 14px;
        font-size: 15px;
        border-radius: 12px;
    }

    .btn-add {
        padding: 8px 12px;
        min-height: 40px;
        font-size: 12px;
    }

    .btn-history-link,
    .back-link {
        padding: 14px;
        min-height: 44px;
    }

    /* ---- Gallery ---- */
    .gallery-grid {
        gap: 8px;
    }

    /* ---- Lightbox ---- */
    .lightbox {
        padding: 10px;
    }

    .lightbox-actions {
        bottom: max(20px, env(safe-area-inset-bottom));
    }

    /* ---- Confirm dialog ---- */
    .confirm-box {
        padding: 20px;
        border-radius: 14px;
    }

    .confirm-btns button {
        padding: 13px;
        min-height: 44px;
    }

    /* ---- Background blobs smaller ---- */
    .bg-blob.b1 {
        width: 200px;
        height: 200px;
    }

    .bg-blob.b2 {
        width: 160px;
        height: 160px;
    }

    .bg-blob.b3 {
        width: 120px;
        height: 120px;
    }

    /* ---- Divider ---- */
    .hr {
        margin: 14px 0;
    }
}

/* =========== EXTRA SMALL DEVICES =========== */
@media (max-width: 360px) {
    body {
        padding: 8px;
    }

    .card {
        padding: 12px;
        border-radius: 12px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .batch-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .btn-add {
        width: 100%;
        text-align: center;
    }

    .common-sender-header {
        padding: 8px 10px;
    }

    .common-sender-fields {
        padding: 0 10px 10px;
    }

    .entry-header {
        padding: 8px 10px;
    }

    .entry-body {
        padding: 0 10px 10px;
    }

    .time-preset-btn {
        font-size: 9px;
        padding: 7px 4px;
    }
}