/* --- Reset & base --- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: #e6f6eb;
    background: #0b0f0c;
}

/* --- Background gradient similar vibe --- */
.bg {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #0b0f0c 0%, #143d14 25%, #0b0f0c 50%, #143d14 75%, #0b0f0c 100%);
    opacity: 0.35;
    pointer-events: none;
}

.container {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #a2e5b2;
    font-size: 14px;
    margin-bottom: 12px;
    gap: 8px;
}

.topbar .brand {
    color: #48ff78;
    font-weight: 700;
}

.topbar .meta {
    opacity: 0.9;
}

.topbar .sep {
    margin: 0 8px;
    opacity: 0.5;
}

.panel {
    background: #111915;
    border: 1px solid #1e3a28;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 24px;
}

h1 {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #7cff9d;
    text-align: center;
}

.field {
    margin: 14px 0;
}

.label {
    display: block;
    margin-bottom: 8px;
    color: #a2e5b2;
    font-size: 13px;
    letter-spacing: .3px;
}

.select,
.text-input {
    width: 100%;
    background: #0f1612;
    color: #e6f6eb;
    border: 1px solid #244931;
    border-radius: 4px;
    padding: 12px 14px;
    outline: none;
}

.select:focus,
.text-input:focus {
    border-color: #38d66b;
    box-shadow: 0 0 0 3px rgba(56, 214, 107, .2);
}

.control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-label {
    color: #d6f6df;
    opacity: .9;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-label {
    position: relative;
    width: 64px;
    height: 30px;
    background: #2a2f2b;
    border: 1px solid #2b4a35;
    border-radius: 999px;
    display: inline-block;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.toggle-knob {
    position: absolute;
    top: 50%;
    left: 4px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #9adfb2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
    transition: left .2s ease, background .2s ease;
}

.toggle-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #eaf9ee;
}

.toggle-text::after {
    content: attr(data-off);
}

.toggle input:checked+.toggle-label {
    background: #1f6d37;
    border-color: #38d66b;
}

.toggle input:checked+.toggle-label .toggle-knob {
    left: 38px;
    background: #48ff78;
}

.toggle input:checked+.toggle-label .toggle-text::after {
    content: attr(data-on);
}

.divider {
    border: none;
    border-top: 1px solid #2b4a35;
    margin: 18px 0;
}

.actions {
    display: flex;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    background: linear-gradient(180deg, #ffb02e, #f48f00);
    color: #1b1200;
    border: 1px solid #d97a00;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 12px 18px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: #25322a;
    color: #bce8c8;
    border-color: #2b4a35;
}

.footer {
    text-align: center;
    color: #46d873;
    margin-top: 18px;
    font-weight: 700;
}

.disclaimer {
    margin-top: 10px;
    font-size: 12px;
    color: #b6d7c1;
    opacity: .9;
    text-align: center;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .55);
    z-index: 50;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #0f1612;
    border: 1px solid #2b4a35;
    border-radius: 8px;
    padding: 20px;
    width: min(520px, 92vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
    text-align: center;
}

.modal h2 {
    margin: 0 0 8px 0;
    color: #86ffad;
}

.modal p {
    margin: 0 0 14px 0;
    color: #cfe9d7;
}

.progress {
    width: 100%;
    height: 12px;
    background: #1a241d;
    border: 1px solid #2b4a35;
    border-radius: 999px;
    overflow: hidden;
}

.bar {
    height: 100%;
    background: linear-gradient(90deg, #38d66b, #7cff9d);
    width: 0%;
    transition: width .2s ease;
}

.result {
    margin-top: 12px;
    color: #e6f6eb;
    min-height: 24px;
}

/* Utility: ensure hidden always wins over later rules */
.hidden {
    display: none !important;
}

/* Simple fade helpers */
.fade-in {
    animation: fadeIn .35s ease forwards;
}

.fade-out {
    animation: fadeOut .35s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Log area */
.log {
    margin-top: 12px;
    background: #0f1411;
    border: 1px solid #2b4a35;
    border-radius: 4px;
    padding: 10px;
    max-height: 180px;
    overflow: auto;
}

.log pre {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #ffb02e;
    white-space: pre-wrap;
}

/* Success visual */
.success {
    display: grid;
    place-items: center;
    margin-top: 10px;
}

.success-ring {
    --size: 180px;
    /* ukuran lingkaran */
    --r: calc(var(--size) / 2 - 2px);
    /* radius ke garis (border 2px) */
    --accent: #48ff78;
    position: relative;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .15);
    display: grid;
    place-items: center;
}

/* Arc segment using SVG stroke */
.success-arc { position: absolute; inset: 0; transform-origin: 50% 50%; animation: orbitArc 2.2s linear infinite; }
.success-arc .arc { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 28 100; stroke-dashoffset: 0; filter: drop-shadow(0 0 8px rgba(72,255,120,.55)); }

.success-orbit {
    position: absolute;
    inset: 0;
    transform-origin: 50% 50%;
    animation: orbit 2.2s linear infinite;
    animation-delay: -0.616s; /* sinkronkan titik dengan ujung arc (~28% dari 360deg) */
}

.success-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #48ff78;
    box-shadow: 0 0 14px rgba(72, 255, 120, .55);
    /* Posisikan pusat titik tepat pada garis lingkaran */
    transform: translate(-50%, -50%) translateY(calc(-1 * var(--r)));
}

.success-text {
    color: #7cff9d;
    letter-spacing: .35em;
    text-indent: .35em;
    font-weight: 700;
}

@keyframes orbit {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes orbitArc {
    from { transform: rotate(-90deg); }
    to { transform: rotate(270deg); }
}

/* ------------------ Responsive tweaks ------------------ */
@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .topbar { flex-wrap: wrap; justify-content: flex-start; }
    .topbar .brand { font-size: 16px; }
    .topbar .meta { font-size: 12px; opacity: .95; }
    .panel { padding: 18px; }
    .label { font-size: 12px; }
    .select, .text-input { padding: 10px 12px; font-size: 14px; }
    .actions { gap: 10px; }
    .btn-primary, .btn-secondary { width: 100%; padding: 12px 14px; }
    .log { max-height: 150px; }
    .success-ring { --size: 150px; }
    .success-text { letter-spacing: .28em; }
}

@media (max-width: 420px) {
    .container { margin: 16px auto; }
    h1 { font-size: 18px; }
    .panel { padding: 14px; }
    .log { max-height: 130px; }
    .success-ring { --size: 130px; }
    .success-text { letter-spacing: .22em; }
}