/* Komponen: tombol, progress, dialog, peringkat, form. */

/* ---------- Tombol ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.55rem 1.1rem;
    border: 0;
    border-radius: var(--radius-m);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.15s, box-shadow 0.1s;
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--btn-bg);
    color: var(--btn-fg);
}

.btn--primary:hover {
    filter: brightness(1.08);
}

.btn--small {
    min-height: 2.25rem;
    padding: 0.35rem 0.85rem;
    font-size: var(--text-s);
}

/* Di atas kain biru */
.btn--gold {
    background: var(--gold);
    color: var(--gold-ink);
    box-shadow: 0 0.2rem 0 var(--gold-lo);
}

.btn--gold:hover {
    filter: brightness(1.05);
}

.btn--gold:active {
    box-shadow: 0 0.075rem 0 var(--gold-lo);
    transform: translateY(0.125rem);
}

.btn--light {
    background: transparent;
    color: var(--stage-ink);
    box-shadow: inset 0 0 0 1.5px var(--stage-line);
}

.btn--light:hover {
    background: oklch(98% 0.01 240 / 0.12);
}

.btn--text {
    min-height: 2.75rem;
    padding-inline: 0.5rem;
    background: transparent;
    color: var(--stage-ink);
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.btn--quiet {
    background: transparent;
    color: var(--ink);
}

.btn--quiet:hover {
    background: var(--paper-sunk);
}

/* ---------- Progress ---------- */

.progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 36rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.progress progress {
    appearance: none;
    width: 100%;
    height: 0.5rem;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: var(--paper-sunk);
}

.progress progress::-webkit-progress-bar {
    background: var(--paper-sunk);
}

.progress progress::-webkit-progress-value {
    background: var(--gold-lo);
    border-radius: 999px;
    transition: width 0.4s;
}

.progress progress::-moz-progress-bar {
    background: var(--gold-lo);
    border-radius: 999px;
}

/* ---------- Dialog ---------- */

.dialog {
    width: min(100% - 1.5rem, 34rem);
    max-height: min(88dvh, 40rem);
    padding: 1.25rem 1.5rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--paper);
    color: var(--ink);
    overflow-y: auto;
}

.dialog--narrow {
    width: min(100% - 1.5rem, 26rem);
}

.dialog::backdrop {
    background: var(--backdrop);
}

.dialog[open] {
    animation: dialog-in 0.18s ease-out;
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
}

.dialog h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: var(--text-l);
}

.dialog__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dialog__close {
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.dialog__close:hover {
    background: var(--paper-sunk);
}

.dialog__hint {
    margin: 0.5rem 0 1rem;
    color: var(--ink-soft);
    font-size: var(--text-s);
}

.dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ---------- Form ---------- */

.field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.field__label {
    font-size: var(--text-s);
    font-weight: 600;
}

.field__error {
    min-height: 1.25em;
    color: var(--danger);
    font-size: var(--text-s);
}

.input,
.select {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--ink-soft);
    border-radius: var(--radius-s);
    background: var(--paper-raised);
}

.input[aria-invalid="true"] {
    border-color: var(--danger);
}

/* ---------- Peringkat ---------- */

.rank-list {
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.rank-row {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

.rank-row[data-mine] {
    background: var(--done-bg);
    color: var(--done-ink);
}

.rank-row__rank {
    font-family: var(--font-display);
    font-size: var(--text-l);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rank-row__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.rank-row__me {
    font-weight: 400;
}

.rank-row__score {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rank-row__score small {
    display: block;
    color: var(--ink-soft);
    font-size: 0.75rem;
}

.rank-row[data-mine] .rank-row__score small {
    color: inherit;
}

.hall-status {
    margin: 1rem 0 0.5rem;
    color: var(--ink-soft);
}
