/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg:           #0d0d1c;
    --bg-card:      #14142a;
    --bg-card-2:    #1a1a35;
    --border:       #2a2a50;
    --red:          #cc2525;
    --red-hover:    #b01e1e;
    --blue:         #3d5080;
    --text:         #f0f0f0;
    --text-muted:   #8888aa;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}

.header-inner {
    max-width: 820px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gintronic-logo {
    height: 28px;
    opacity: 0.9;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.header-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Main ──────────────────────────────────────────────────────────────────── */
main {
    max-width: 820px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.device-logo {
    width: min(380px, 90%);
    margin-bottom: 0.75rem;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.card-body {
    padding: 2rem;
}

/* ── Form elements ─────────────────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

select.form-select {
    background-color: var(--bg-card-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%238888aa' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

select.form-select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(61, 80, 128, 0.25);
}

select.form-select option {
    background: var(--bg-card-2);
}

/* ── Action row ────────────────────────────────────────────────────────────── */
.action-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-connect {
    background: var(--bg-card-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-connect:not(:disabled):hover {
    background: var(--border);
}

.btn-flash {
    background: var(--red);
    color: #fff;
}

.btn-flash:not(:disabled):hover {
    background: var(--red-hover);
}

/* ── Status badge ──────────────────────────────────────────────────────────── */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

/* ── Divider ───────────────────────────────────────────────────────────────── */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.75rem 0;
}

/* ── Progress ──────────────────────────────────────────────────────────────── */
.progress-wrap {
    margin-bottom: 0.4rem;
}

.progress-track {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--red);
    border-radius: 6px;
    transition: width 0.2s ease;
    width: 0%;
}

.progress-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    text-align: right;
}

/* ── Log ───────────────────────────────────────────────────────────────────── */
.log-wrap {
    background: #09091a;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    height: 160px;
    overflow-y: auto;
    font-size: 0.8rem;
    font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
    color: #a0a0c0;
    line-height: 1.6;
}

.log-wrap .text-warning { color: #e8a020 !important; }
.log-wrap .text-danger  { color: #e04040 !important; }
.log-wrap .text-success { color: #40c070 !important; }

/* ── Release notes ─────────────────────────────────────────────────────────── */
.release-notes {
    margin-top: 0.6rem;
    padding: 0.7rem 1rem;
    background: #09091a;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ── Browser warning ───────────────────────────────────────────────────────── */
.browser-warning {
    background: rgba(204, 37, 37, 0.1);
    border: 1px solid rgba(204, 37, 37, 0.4);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    color: #f08080;
    margin-bottom: 1.5rem;
}

.browser-warning strong {
    color: #f0a0a0;
}

/* ── Instructions ──────────────────────────────────────────────────────────── */
.instructions {
    background: var(--bg-card-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.instructions h6 {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

.instructions ol {
    margin: 0;
    padding-left: 1.25rem;
}

.instructions li {
    margin-bottom: 0.3rem;
}

.flash-warning {
    margin-top: 1rem;
    padding: 0.65rem 1rem;
    background: rgba(204, 37, 37, 0.1);
    border: 1px solid rgba(204, 37, 37, 0.4);
    border-radius: 6px;
    font-size: 0.85rem;
    color: #f08080;
}

.flash-warning strong {
    color: #f0a0a0;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 2rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

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

footer a:hover {
    color: var(--text);
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.d-none { display: none !important; }
.mb-1   { margin-bottom: 0.5rem; }
.mb-2   { margin-bottom: 1rem; }
.mb-3   { margin-bottom: 1.5rem; }
.mt-3   { margin-top: 1.5rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    main       { padding: 2rem 1rem 3rem; }
    header     { padding: 0.85rem 1rem; }
    .card-body { padding: 1.25rem; }
    .action-row { flex-direction: column; align-items: flex-start; }
    .btn       { width: 100%; justify-content: center; }
}
