* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

:root {
    --body-bg: #111;
    --card-bg: #1c1c1c;
    --surface: #111;
    --surface-2: #151515;
    --border: #333;
    --border-soft: #292929;
    --text: #fff;
    --text-secondary: #aaa;
    --text-muted: #777;
    --text-dim: #555;
    --button-bg: #fff;
    --button-text: #111;
    --shadow: 0 0 30px rgba(255, 255, 255, 0.08);
    --modal-bg: rgba(0, 0, 0, 0.75);
}

/* =========================================
   LIGHT THEME
========================================= */

body.light-mode {
    --body-bg: #eef1f5;
    --card-bg: #fff;
    --surface: #f5f7fa;
    --surface-2: #fff;
    --border: #dfe3e8;
    --border-soft: #e5e8ec;
    --text: #171717;
    --text-secondary: #555;
    --text-muted: #777;
    --text-dim: #999;
    --button-bg: #171717;
    --button-text: #fff;
    --shadow: 0 15px 45px rgba(0, 0, 0, 0.1);
    --modal-bg: rgba(255, 255, 255, 0.72);
}

/* =========================================
   BODY
========================================= */

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 85px 20px 20px;
    background: var(--body-bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

h4 {
    margin-top: 8px;
}

/* =========================================
   CALCULATOR
========================================= */

.calculator {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    padding: 25px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* =========================================
   TIMESTAMP
========================================= */

.hacker-timestamp {
    position: absolute;
    top: 12px;
    left: 10px;
    z-index: 10;
    color: #00ff66;
    font-family: "Courier New", monospace;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
    user-select: none;
    text-shadow:
        0 0 5px rgba(0, 255, 102, 0.7),
        0 0 10px rgba(0, 255, 102, 0.3);
}

body.light-mode .hacker-timestamp {
    color: #00965e;
    text-shadow:
        0 0 3px rgba(0, 150, 94, 0.2),
        0 0 6px rgba(0, 150, 94, 0.08);
}

/* =========================================
   HEADER
========================================= */

.header {
    margin-bottom: 25px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    font-size: 32px;
}

.logo img {
    width: 150px;
    height: 50px;
    object-fit: contain;
}

.header h1 {
    font-size: 25px;
}

.header p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

/* =========================================
   LABEL
========================================= */

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* =========================================
   INPUT / SELECT
========================================= */

select,
input {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

select:focus,
input:focus {
    border-color: #888;
}

#amount::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* =========================================
   CURRENCY DISPLAY
========================================= */

.currency-display {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

/* =========================================
   SWAP
========================================= */

.swap {
    display: block;
    width: 45px;
    height: 45px;
    margin: -5px auto 15px;
    border: none;
    border-radius: 50%;
    background: var(--button-bg);
    color: var(--button-text);
    font-size: 20px;
    cursor: pointer;
    transition:
        transform 0.3s ease,
        background 0.3s ease,
        color 0.3s ease;
}

.swap:hover {
    transform: rotate(180deg);
}

/* =========================================
   RESULT
========================================= */

.result {
    margin-top: 10px;
    padding: 20px;
    border-radius: 15px;
    background: var(--surface);
    text-align: center;
    transition: background 0.3s ease;
}

.result-title {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.result-value {
    color: var(--text);
    font-size: 28px;
    font-weight: bold;
    word-break: break-word;
}

/* =========================================
   RATE
========================================= */

.rate {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.api-status {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
}

/* =========================================
   MASTER BUTTON
========================================= */

.master-button {
    position: fixed;
    top: 40px;
    left: 20px;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 0;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease;
}

.master-button::before {
    content: "🔐";
    font-size: 19px;
}

.master-button:hover {
    background: #fff;
    color: #111;
    border-color: #777;
    transform: scale(1.05);
}

body.light-mode .master-button {
    background: #111;
    color: #fff;
}

body.light-mode .master-button:hover {
    background: #111;
    color: #fff;
}

/* =========================================
   MASTER PANEL
========================================= */

.master-panel {
    display: none;
    margin-top: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
}

.master-panel.active {
    display: block;
}

.master-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.master-header strong {
    display: block;
    font-size: 15px;
}

.master-header small {
    display: block;
    margin-top: 4px;
    color: var(--text-dim);
}

/* =========================================
   LOGOUT
========================================= */

.logout {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
}

.logout:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* =========================================
   RATE INPUT
========================================= */

.rate-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rate-input input {
    margin: 0;
}

.rate-input span {
    color: var(--text-muted);
    font-size: 14px;
}

/* =========================================
   BUTTONS
========================================= */

.save-button,
.login-button {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 9px;
    background: var(--button-bg);
    color: var(--button-text);
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.save-button:hover,
.login-button:hover {
    opacity: 0.8;
}

.password-button {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.3s;
}

.password-button:hover {
    background: var(--surface);
    color: var(--text);
}

/* =========================================
   MESSAGES
========================================= */

.master-message,
.account-message {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.login-message {
    min-height: 16px;
    margin-top: 12px;
    color: #ff6b6b;
    font-size: 12px;
}

.account-title {
    margin-bottom: 15px;
    color: var(--text);
    font-size: 14px;
    font-weight: bold;
}

/* =========================================
   HR
========================================= */

hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid var(--border-soft);
}

/* =========================================
   LOGIN MODAL
========================================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--modal-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.login-box {
    position: relative;
    width: 100%;
    max-width: 360px;
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-icon {
    margin-bottom: 8px;
    font-size: 35px;
}

.login-box h2 {
    font-size: 21px;
}

.login-box p {
    margin: 7px 0 20px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================
   CLOSE
========================================= */

.close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 25px;
    cursor: pointer;
}

.close:hover {
    color: var(--text);
}

/* =========================================
   THEME TOGGLE
========================================= */

.theme-toggle {
    position: fixed;
    top: 40px;
    right: 20px;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 19px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(20deg) scale(1.05);
}

body.light-mode .theme-toggle {
    background: #111;
    color: #fff;
}

/* =========================================
   LED RUNNING TEXT
========================================= */

.idr-ticker {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1500;
    width: 100%;
    height: 34px;
    overflow: hidden;
    display: flex;
    align-items: center;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 255, 102, 0.025) 0px,
            rgba(0, 255, 102, 0.025) 1px,
            transparent 1px,
            transparent 3px
        ),
        #050505;
    border-bottom: 1px solid rgba(0, 255, 102, 0.25);
    box-shadow:
        0 0 10px rgba(0, 255, 102, 0.08),
        inset 0 -1px 0 rgba(0, 255, 102, 0.08);
    white-space: nowrap;
}

.idr-ticker-track {
    display: inline-block;
    padding-left: 100%;
    color: #00ff66;
    font-family: "Courier New", monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow:
        0 0 3px rgba(0, 255, 102, 0.9),
        0 0 7px rgba(0, 255, 102, 0.7),
        0 0 14px rgba(0, 255, 102, 0.35);
    animation:
        idrTickerMove 18s linear infinite,
        ledFlicker 3s infinite;
    will-change: transform;
}

@keyframes idrTickerMove {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

@keyframes ledFlicker {
    0%,
    100% {
        opacity: 1;
    }

    48% {
        opacity: 1;
    }

    49% {
        opacity: 0.92;
    }

    50% {
        opacity: 1;
    }

    92% {
        opacity: 1;
    }

    93% {
        opacity: 0.95;
    }
}

body.light-mode .idr-ticker {
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 150, 94, 0.025) 0px,
            rgba(0, 150, 94, 0.025) 1px,
            transparent 1px,
            transparent 3px
        ),
        #111;
    border-bottom-color: rgba(0, 150, 94, 0.25);
}

body.light-mode .idr-ticker-track {
    color: #00c96b;
    text-shadow:
        0 0 3px rgba(0, 150, 94, 0.8),
        0 0 7px rgba(0, 150, 94, 0.4);
}

/* =========================================
   FOOTER
========================================= */

footer {
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 450px) {

    body {
        width: 100%;
        padding: 83px 10px 6px;
        align-items: center;
    }

    .calculator {
        width: 100%;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        padding: 17px;
    }

    .header {
        margin-bottom: 15px;
    }

    .result-value {
        font-size: 25px;
    }

    .theme-toggle {
        top: 38px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .master-button {
        top: 38px;
        left: 12px;
        width: 40px;
        height: 40px;
    }

    .master-button::before {
        font-size: 17px;
    }

    .hacker-timestamp {
        top: 10px;
        left: 10px;
        font-size: 10px;
    }

    .idr-ticker {
        height: 30px;
    }

    .idr-ticker-track {
        font-size: 11px;
        letter-spacing: 0.7px;
        animation-duration: 14s;
    }

    .logo {
        margin-bottom: 3px;
    }

    .logo img {
        width: 95px;
        height: 36px;
    }

    footer {
        margin-top: 5px;
        padding: 4px 10px;
        font-size: 10px;
    }
}

/* =========================================
   TOP BUTTON + LOGO LAYOUT
========================================= */

.theme-toggle,
.master-button {
    top: 40px;
}

.logo {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    margin: 0;
}

.logo img {
    width: 120px;
    height: 40px;
    object-fit: contain;
}

.swap {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    margin: -2px auto 10px;

    padding: 0;

    border: 2px solid #00a854;
    border-radius: 50%;

    background: transparent;
    cursor: pointer;

    box-shadow: 0 0 10px rgba(0, 168, 84, 0.15);

    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.swap img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.swap:hover {
    transform: scale(1.08);
    border-color: #00c96b;
    box-shadow: 0 0 16px rgba(0, 168, 84, 0.35);
}