:root {
    --bg: #07090a;
    --panel: #101517;
    --panel-deep: #0b1012;
    --line: rgba(132, 255, 150, 0.18);
    --text: #c9ffd1;
    --muted: #7a9b82;
    --accent: #8aff9b;
    --accent-strong: #d7ff75;
    --shadow: rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Courier New", Courier, monospace;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(80, 140, 90, 0.14), transparent 40%),
        linear-gradient(180deg, #050607 0%, #0a0d0f 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 4px;
    opacity: 0.12;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.radio-panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(18, 25, 27, 0.98), rgba(8, 11, 12, 0.98));
    border: 1px solid rgba(138, 255, 155, 0.18);
    border-radius: 18px;
    box-shadow: 0 18px 50px var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.radio-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 35%, rgba(138, 255, 155, 0.06));
    pointer-events: none;
}

.panel-glow {
    position: absolute;
    inset: auto 16px 0 16px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 18px rgba(138, 255, 155, 0.45);
}

.hero-card,
.form-card,
.info-card,
.result-card,
.widget-panel {
    padding: 22px;
}

.hero-copy h1,
.form-card h2,
.info-card h2,
.result-card h2 {
    margin: 0 0 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-copy h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.1;
    max-width: 16ch;
    text-shadow: 0 0 18px rgba(138, 255, 155, 0.18);
}

.eyebrow,
.panel-label,
.widget-footer,
.small-note,
.status-line,
.usage-list {
    letter-spacing: 0.08em;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent-strong);
    font-size: 0.82rem;
}

.hero-text,
.small-note,
.usage-list,
.widget-footer,
.status-line {
    color: var(--muted);
}

.counter-form {
    display: grid;
    gap: 12px;
}

.counter-form label,
.result-card label {
    color: var(--accent-strong);
    text-transform: uppercase;
    font-size: 0.82rem;
}

.counter-form input,
.result-card textarea {
    width: 100%;
    border: 1px solid rgba(138, 255, 155, 0.16);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text);
    background: var(--panel-deep);
    font: inherit;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.counter-form input:focus,
.result-card textarea:focus {
    border-color: rgba(138, 255, 155, 0.42);
    box-shadow: 0 0 0 3px rgba(138, 255, 155, 0.12);
}

.char-count {
    align-self: flex-end;
    margin-top: -2px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(138, 255, 155, 0.12);
    background: rgba(138, 255, 155, 0.06);
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.counter-form button {
    border: 0;
    border-radius: 12px;
    padding: 14px 16px;
    color: #041006;
    background: linear-gradient(180deg, #b8ff7d, #70d96f);
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(80, 130, 80, 0.35);
}

.counter-form button:hover {
    filter: brightness(1.06);
}

.usage-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 10px;
}

.status-line {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(138, 255, 155, 0.12);
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.result-meta div {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(138, 255, 155, 0.08);
}

.result-meta span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.78rem;
}

.result-meta strong {
    word-break: break-all;
    color: var(--text);
}

.result-card label {
    display: inline-block;
    margin: 4px 0 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(138, 255, 155, 0.08);
    border: 1px solid rgba(138, 255, 155, 0.14);
}

.result-meta div:first-child strong {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(138, 255, 155, 0.08);
    border: 1px solid rgba(138, 255, 155, 0.14);
    font-size: 1.05rem;
}

.preview-wrap {
    margin-top: 14px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px dashed rgba(138, 255, 155, 0.18);
}

.preview-wrap iframe {
    display: block;
    width: 100%;
    max-width: 320px;
    border: 0;
    overflow: hidden;
}

.widget-body {
    margin: 0;
    padding: 0;
    background: transparent;
}

.widget-panel {
    width: 100%;
    min-height: 164px;
    border-radius: 14px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    color: var(--accent-strong);
    text-transform: uppercase;
    font-size: 0.75rem;
}

.panel-subtitle {
    color: var(--muted);
    text-align: right;
}

.widget-readout {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas:
        "flag code"
        "count count";
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(8, 14, 9, 0.9), rgba(13, 19, 15, 0.96));
    border: 1px solid rgba(138, 255, 155, 0.16);
    box-shadow: inset 0 0 22px rgba(138, 255, 155, 0.05);
}

.widget-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(138,255,155,0.06);
}

.leader-flag {
    width: 24px;
    height: 14px;
    object-fit: cover;
    border-radius: 3px;
}

.leader-code {
    color: var(--accent-strong);
    font-weight: 600;
    letter-spacing: 0.12em;
}

.leader-count {
    margin-left: auto;
    color: var(--accent);
    font-weight: 700;
}

.tab-content {
    display: block;
}

.tab-content.is-hidden {
    display: none !important;
}

.tabs {
    display: inline-flex;
    gap: 8px;
    padding: 8px;
    margin: 10px 14px 0 14px;
    background: linear-gradient(180deg, rgba(5,8,6,0.6), rgba(10,16,10,0.45));
    border-radius: 10px;
    border: 1px solid rgba(138,255,155,0.06);
    z-index: 5;
}

.tab-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(10,14,8,0.18));
    border: 1px solid rgba(138,255,155,0.06);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: monospace;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 160ms ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.45), inset 0 -6px 18px rgba(0,0,0,0.12);
}

.tab-btn:hover {
    transform: translateY(-1px);
    color: var(--accent-strong);
    border-color: rgba(138,255,155,0.12);
}

.tab-btn:focus { outline: none; box-shadow: 0 0 0 4px rgba(138,255,155,0.06); }

.tab-btn.active {
    background: linear-gradient(180deg, rgba(12,22,14,0.98), rgba(18,34,18,0.85));
    color: var(--accent-strong);
    border-color: rgba(138,255,155,0.24);
    box-shadow: 0 8px 30px rgba(0,0,0,0.55), inset 0 2px 10px rgba(138,255,155,0.04);
}

.tabs .tab-btn + .tab-btn { margin-left: 6px; }

.leader-rank {
    color: var(--muted);
    width: 28px;
    text-align: right;
}

.leader-name {
    color: var(--text);
}

.leader-percent {
    margin-left: auto;
    color: var(--accent-strong);
    font-weight: 700;
}

.flag-shell {
    width: 40px;
    height: 40px;
    grid-area: flag;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(138, 255, 155, 0.12);
    flex: 0 0 auto;
}

.flag-image {
    width: 26px;
    height: 18px;
    display: block;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 14px rgba(138, 255, 155, 0.2);
}

.country-code {
    grid-area: code;
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
    letter-spacing: 0.15em;
    color: var(--accent-strong);
    text-shadow: 0 0 12px rgba(215, 255, 117, 0.24);
    min-width: 0;
}

.visit-count {
    grid-area: count;
    justify-self: start;
    margin-top: 2px;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 0 16px rgba(138, 255, 155, 0.2);
}

.country-code,
.visit-count {
    white-space: nowrap;
}

.small-note {
    margin: 14px 0 0;
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 18px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .widget-readout {
        grid-template-columns: 40px 1fr;
        grid-template-areas:
            "flag code"
            "count count";
    }
}

/* High-specificity overrides to force tab appearance even if host styles apply */
.radio-panel .widget-panel .tabs .tab-btn,
.widget-panel .tabs .tab-btn,
.tabs .tab-btn,
button.tab-btn,
a.tab-btn {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    background: linear-gradient(180deg, rgba(12,22,14,0.98), rgba(18,34,18,0.85)) !important;
    color: var(--accent-strong) !important;
    border: 1px solid rgba(138,255,155,0.24) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.55), inset 0 2px 10px rgba(138,255,155,0.04) !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    outline: none !important;
    text-decoration: none !important;
}

/* Defensive: ensure icon fonts or system styles don't override color */
.radio-panel .widget-panel .tabs .tab-btn *,
.widget-panel .tabs .tab-btn * {
    color: inherit !important;
}

/* If host CSS forces a UA-style background, explicitly reset it */
.radio-panel .widget-panel .tabs .tab-btn::-webkit-button-down-arrow { display: none !important; }
