:root {
    color-scheme: dark;
    --bg: #05070f;
    --panel: rgba(10, 13, 24, 0.96);
    --panel-soft: rgba(16, 20, 32, 0.9);
    --text: #f5eef3;
    --muted: #a99fac;
    --ultra: #5860c8;
    --pulse: #49b874;
    --slate-glow: #8796ab;
    --border: rgba(88, 96, 200, 0.2);
    --shadow: rgba(0, 0, 0, 0.5);
    --radius: 8px;
    font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    padding-bottom: 78px;
    color: var(--text);
    background:
        linear-gradient(rgba(88, 96, 200, 0.016) 1px, transparent 1px),
        linear-gradient(90deg, rgba(73, 184, 116, 0.014) 1px, transparent 1px),
        linear-gradient(135deg, rgba(88, 96, 200, 0.035), transparent 34%),
        linear-gradient(315deg, rgba(73, 184, 116, 0.03), transparent 38%),
        var(--bg);
    background-size: 34px 34px, 34px 34px, auto, auto, auto;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button,
input[type="file"],
input[type="radio"],
input[type="number"] {
    cursor: pointer;
}

a {
    color: var(--pulse);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-header {
    border-bottom: 1px solid rgba(88, 96, 200, 0.16);
    background: linear-gradient(90deg, rgba(88, 96, 200, 0.052), rgba(73, 184, 116, 0.032)), rgba(5, 7, 15, 0.94);
    box-shadow: 0 12px 30px var(--shadow);
}

h1 {
    margin: 0;
    font-family: "Cascadia Mono", "Segoe UI", monospace;
    font-size: clamp(1.6rem, 4vw, 2.75rem);
    line-height: 1.05;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(88, 96, 200, 0.12);
}

h1 a,
h1 a:hover {
    color: inherit;
    text-decoration: none;
}

.header-tagline.is-typing {
    min-width: var(--typing-width, auto);
}

.header-tagline.is-typing::after {
    content: "";
    width: 8px;
    height: 1em;
    margin-left: 4px;
    display: inline-block;
    vertical-align: -2px;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: cursor-blink 800ms steps(2, start) infinite;
}

.header-tagline {
    max-width: 680px;
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.mute-shell {
    width: min(1080px, calc(100% - 32px));
    margin: 30px auto 56px;
}

.limit-strip,
.mute-panel,
.info-panel,
.notice {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 0 14px rgba(88, 96, 200, 0.035), 0 14px 34px var(--shadow);
}

.limit-strip {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 18px;
    color: var(--muted);
}

.notice {
    margin-top: 16px;
    padding: 14px;
}

.notice[hidden] {
    display: none;
}

.notice--success {
    border-color: rgba(73, 184, 116, 0.3);
}

.notice--error {
    color: #ffe5eb;
    border-color: rgba(229, 92, 112, 0.32);
    background: rgba(116, 31, 51, 0.58);
}

.notice--attention {
    animation: notice-pulse 2400ms ease-out 1;
}

.mute-panel,
.info-panel {
    margin-top: 18px;
    padding: clamp(16px, 4vw, 30px);
}

.mute-form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.5fr);
    gap: 16px;
}

.mute-form > *,
.form-grid > *,
.field > *,
.mode-field > *,
.interval-row > *,
.time-group > *,
.download-item > * {
    min-width: 0;
}

.field,
.mode-field {
    display: grid;
    gap: 8px;
}

.field span,
.mode-field legend {
    color: var(--ultra);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.time-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.time-part {
    display: grid;
    gap: 6px;
}

.time-part span {
    color: var(--pulse);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-align: center;
}

.interval-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.interval-number {
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff8fb;
    border: 1px solid rgba(88, 96, 200, 0.44);
    border-radius: 50%;
    background: rgba(88, 96, 200, 0.18);
    box-shadow: 0 0 8px rgba(88, 96, 200, 0.12);
    font-size: 0.75rem;
    line-height: 1;
}

.time-field {
    text-align: center;
}

.mode-field {
    margin: 0;
    padding: 0;
    align-content: end;
    border: 0;
}

.mode-field label {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
}

input[type="file"],
input[type="number"],
input[type="text"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    color: var(--text);
    border: 1px solid rgba(73, 184, 116, 0.22);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
    outline: none;
}

input[type="radio"] {
    accent-color: var(--ultra);
}

input:focus {
    border-color: var(--ultra);
    box-shadow: 0 0 0 3px rgba(88, 96, 200, 0.1);
}

.hint,
.duration-label {
    margin: 0;
    color: var(--muted);
}

.preview-panel {
    display: grid;
    gap: 12px;
}

.preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.preview-panel[hidden],
.interval-panel[hidden] {
    display: none;
}

video {
    width: 100%;
    max-height: 460px;
    border: 1px solid rgba(88, 96, 200, 0.15);
    border-radius: 6px;
    background: #000;
}

.interval-panel {
    padding: 14px;
    display: grid;
    gap: 12px;
    border: 1px solid rgba(73, 184, 116, 0.2);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(73, 184, 116, 0.045), transparent 44%),
        rgba(0, 0, 0, 0.18);
}

.interval-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.interval-header h2 {
    margin: 0;
    color: var(--ultra);
    font-size: 1rem;
    text-transform: uppercase;
}

.interval-list {
    display: grid;
    gap: 10px;
}

.interval-row {
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    border: 1px solid rgba(73, 184, 116, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.16);
}

.button-primary,
.button-secondary,
.button-danger,
.icon-button,
.download-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #16070d;
    border: 1px solid rgba(73, 184, 116, 0.24);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--ultra), var(--slate-glow));
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 4px 0 rgba(0, 0, 0, 0.34);
    font-weight: 900;
    text-transform: uppercase;
    text-decoration: none;
}

.download-link {
    width: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 1.1rem;
}

.download-link:hover,
.download-link:focus-visible {
    text-decoration: none;
    outline: none;
}

.button-primary {
    justify-self: center;
    min-width: 220px;
}

.button-secondary {
    justify-self: start;
}

.button-danger {
    color: #fff;
    border-color: rgba(229, 92, 112, 0.44);
    background: linear-gradient(135deg, #a82d45, #d94d66);
    box-shadow:
        inset 0 -3px 0 rgba(0, 0, 0, 0.24),
        0 4px 0 rgba(70, 12, 24, 0.92);
}

.button-small {
    min-width: 126px;
    min-height: 36px;
    padding: 7px 10px;
}

.icon-button {
    width: 42px;
    padding: 0;
}

.icon-button--danger {
    color: #fff;
    background: linear-gradient(135deg, #a82d45, #d94d66);
}

.remove-file-button {
    justify-self: start;
}

.button-primary:active,
.button-secondary:active,
.button-danger:active,
.icon-button:active,
.download-link:active {
    transform: scaleY(0.92);
    transform-origin: bottom;
}

.button-primary:disabled,
.button-secondary:disabled,
.button-danger:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.download-item {
    margin-top: 12px;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
    gap: 12px;
    border: 1px solid rgba(73, 184, 116, 0.15);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.18);
}

.download-name-field {
    display: grid;
    gap: 6px;
}

.download-preview {
    width: 100%;
    max-height: 320px;
    grid-column: 1 / -1;
    border: 1px solid rgba(88, 96, 200, 0.17);
    border-radius: 6px;
    background: #000;
}

.download-meta {
    display: grid;
    gap: 2px;
    color: var(--muted);
    font-family: "Cascadia Mono", "Segoe UI", monospace;
    font-weight: 800;
}

.download-error {
    grid-column: 1 / -1;
    min-height: 1.2em;
    color: #ffb6c2;
}

.is-invalid {
    border-color: var(--ultra);
    animation: input-alert-pulse 950ms ease-in-out 2;
    box-shadow: 0 0 0 3px rgba(88, 96, 200, 0.1), 0 0 12px rgba(88, 96, 200, 0.1);
}

.info-panel h2 {
    margin: 0 0 12px;
    color: var(--ultra);
}

.info-panel p {
    margin: 10px 0 0;
    color: var(--muted);
}

.privacy-note {
    padding: 10px 12px;
    border-left: 3px solid var(--pulse);
    border-radius: 6px;
    background: rgba(73, 184, 116, 0.045);
}

dialog {
    color: var(--text);
    border: 1px solid rgba(88, 96, 200, 0.24);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 52px var(--shadow);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
}

.loading-dialog {
    width: min(420px, calc(100% - 28px));
    padding: 14px;
    text-align: center;
}

.loading-dialog[open] {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.loading-dialog h2 {
    margin: 0;
    color: var(--ultra);
    font-size: 1rem;
    line-height: 1.15;
    text-transform: uppercase;
}

.loading-dialog p,
.confirm-dialog p {
    margin: 0;
    color: var(--muted);
}

#loadingTimer {
    min-width: 86px;
    padding: 7px 12px;
    color: var(--pulse);
    border: 1px solid rgba(73, 184, 116, 0.24);
    border-radius: 6px;
    background: rgba(73, 184, 116, 0.055);
    font-family: inherit;
}

.cancel-process-button {
    margin-top: 4px;
}

.confirm-dialog {
    width: min(380px, calc(100% - 28px));
    padding: 14px;
}

.confirm-dialog form {
    display: grid;
    gap: 10px;
}

.dialog-header {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dialog-header h2 {
    margin: 0;
    color: var(--ultra);
    font-size: 1rem;
    line-height: 1.15;
    text-transform: uppercase;
}

.dialog-close {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 6px;
    background: #a82d45;
    font-weight: 900;
}

.dialog-actions {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.noscript-alert {
    width: min(1080px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px 14px;
    color: #ffe1e8;
    border: 1px solid rgba(229, 92, 112, 0.34);
    border-radius: var(--radius);
    background: rgba(255, 79, 109, 0.12);
}

@keyframes cursor-blink {
    50% {
        opacity: 0;
    }
}

@keyframes notice-pulse {
    0%,
    100% {
        box-shadow: 0 0 14px rgba(88, 96, 200, 0.035), 0 14px 34px var(--shadow);
    }

    50% {
        border-color: rgba(73, 184, 116, 0.62);
        box-shadow:
            0 0 0 2px rgba(73, 184, 116, 0.09),
            0 0 20px rgba(73, 184, 116, 0.12),
            0 14px 34px var(--shadow);
    }
}

@keyframes input-alert-pulse {
    50% {
        border-color: rgba(255, 255, 255, 0.72);
        box-shadow: 0 0 0 3px rgba(88, 96, 200, 0.12), 0 0 16px rgba(88, 96, 200, 0.12);
    }
}

@media (max-width: 760px) {
    .mute-shell {
        width: calc(100% - 20px);
    }

    .limit-strip {
        justify-content: center;
        text-align: center;
    }

    .form-grid,
    .interval-row,
    .download-item {
        grid-template-columns: 1fr;
    }

    .preview-actions {
        width: 100%;
    }

    .button-primary,
    .button-secondary,
    .button-danger {
        width: 100%;
    }

    .button-small {
        width: auto;
    }

    body {
        padding-bottom: 0;
    }
}

@media (max-width: 425px) {
    .mode-field {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
    }

    .mode-field legend {
        grid-column: 1 / -1;
    }

    .mode-field label {
        min-height: 42px;
        padding: 8px 9px;
        justify-content: center;
        border: 1px solid rgba(73, 184, 116, 0.15);
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.18);
        font-size: 0.86rem;
        text-align: center;
    }

    .download-item {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .download-name-field,
    .download-error {
        grid-column: 1 / -1;
    }

    .download-meta {
        display: contents;
    }

    .download-meta small {
        grid-column: 1 / -1;
        text-align: center;
    }

    .download-meta span {
        grid-column: 1;
        align-self: center;
    }

    .download-link {
        grid-column: 2;
        align-self: center;
    }

    .interval-remove-button {
        justify-self: center;
    }
}

@media (width: 320px) {
    .confirm-dialog {
        width: calc(100% - 18px);
        padding: 10px;
    }

    .confirm-dialog form {
        gap: 8px;
    }

    .dialog-actions {
        gap: 10px;
    }

    .dialog-actions .button-small {
        min-width: 92px;
        padding-inline: 10px;
    }
}

.file-details,
.loading-timer,
.download-size,
.duration-label,
.interval-number {
    font-family: var(--font-data), "Cascadia Mono", "Segoe UI", monospace;
}
