@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

:root {
    --bg:         #080b08;
    --surface:    #0d120d;
    --border:     rgba(74, 246, 38, 0.18);
    --text:       #c8f0c0;
    --dim:        rgba(200, 240, 192, 0.45);
    --accent:     #4af626;
    --glow:       rgba(74, 246, 38, 0.35);
    --glow-soft:  rgba(74, 246, 38, 0.12);
    --red:        #ff4444;
    --mono:       'Share Tech Mono', 'Courier New', monospace;
    --display:    'VT323', monospace;
    --radius:     2px;
}

body.theme-light {
    --bg:         #f4f0e8;
    --surface:    #ece8df;
    --border:     rgba(80, 60, 20, 0.2);
    --text:       #2a2010;
    --dim:        rgba(42, 32, 16, 0.45);
    --accent:     #8b5e0a;
    --glow:       rgba(139, 94, 10, 0.25);
    --glow-soft:  rgba(139, 94, 10, 0.08);
    --red:        #c0392b;
}

*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--mono);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 80px;
    transition: background 0.4s, color 0.4s;
    position: relative;
    overflow-x: hidden;
    font-size: 16px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.08) 2px,
        rgba(0,0,0,0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
    z-index: 9998;
}

body.theme-light::before {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
}
body.theme-light::after {
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.15) 100%);
}

.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    z-index: 1000;
    font-size: 15px;
    letter-spacing: 0.1em;
    color: var(--dim);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar-logo {
    font-family: var(--display);
    font-size: 26px;
    color: var(--accent);
    letter-spacing: 3px;
    text-shadow: 0 0 12px var(--glow);
}

.top-bar-status {
    display: flex;
    align-items: center;
    gap: 7px;
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    animation: blink 2.4s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 15px;
    color: var(--dim);
    letter-spacing: 0.12em;
    padding: 4px 10px;
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    color: var(--accent);
    background: var(--glow-soft);
}

.nav-btn-icon {
    opacity: 0.6;
    font-size: 13px;
}

.container {
    width: 100%;
    max-width: 460px;
    position: relative;
    z-index: 1;
}

.page-title {
    font-family: var(--display);
    font-size: 18px;
    color: var(--dim);
    letter-spacing: 0.25em;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title::before {
    content: '';
    display: block;
    width: 20px;
    height: 1px;
    background: var(--dim);
}

.input-group {
    position: relative;
    margin-bottom: 12px;
}

.input-label {
    font-size: 13px;
    letter-spacing: 0.2em;
    color: var(--dim);
    margin-bottom: 8px;
    display: block;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 18px;
    letter-spacing: 0.12em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    caret-color: var(--accent);
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow-soft), inset 0 0 20px var(--glow-soft);
}

input[type="text"]::placeholder {
    color: rgba(200, 240, 192, 0.2);
    letter-spacing: 0.08em;
}

body.theme-light input[type="text"]::placeholder {
    color: rgba(42, 32, 16, 0.25);
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    transition: background-color 9999s;
}

.error-message {
    font-size: 14px;
    letter-spacing: 0.15em;
    color: var(--red);
    margin-top: 8px;
    margin-bottom: 4px;
    min-height: 20px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-message::before { content: '! '; }

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.generate-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 16px;
    letter-spacing: 0.25em;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.generate-btn:hover::before { opacity: 0.06; }
.generate-btn:hover {
    box-shadow: 0 0 20px var(--glow), inset 0 0 20px var(--glow-soft);
}

.generate-btn:active {
    transform: scale(0.99);
}

.generate-btn span { position: relative; z-index: 1; }

.result-section {
    display: none;
    margin-top: 40px;
    animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.totp-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 28px 24px 20px;
    position: relative;
    overflow: hidden;
}

.totp-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

.totp-label {
    font-size: 13px;
    letter-spacing: 0.25em;
    color: var(--dim);
    margin-bottom: 16px;
}

.totp-display {
    font-family: var(--display);
    font-size: 92px;
    line-height: 1;
    letter-spacing: 14px;
    color: var(--accent);
    text-shadow: 0 0 30px var(--glow), 0 0 60px rgba(74,246,38,0.15);
    cursor: pointer;
    transition: opacity 0.15s, text-shadow 0.15s;
    user-select: none;
    margin-bottom: 4px;
    display: block;
}

.totp-display:hover {
    opacity: 0.85;
    text-shadow: 0 0 40px var(--glow), 0 0 80px rgba(74,246,38,0.2);
}

.totp-display.copied {
    animation: flashCopy 0.3s ease;
}

@keyframes flashCopy {
    0%   { opacity: 1; }
    40%  { opacity: 0.4; letter-spacing: 20px; }
    100% { opacity: 1; letter-spacing: 14px; }
}

.copy-hint {
    font-size: 13px;
    letter-spacing: 0.2em;
    color: var(--dim);
    opacity: 0;
    transition: opacity 0.2s;
    margin-bottom: 20px;
    height: 16px;
}

.totp-card:hover .copy-hint { opacity: 1; }

.copy-hint.copied-msg {
    opacity: 1 !important;
    color: var(--accent);
    animation: fadeOut 1.2s ease 0.3s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.timer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.timer-text {
    font-size: 15px;
    color: var(--dim);
    letter-spacing: 0.1em;
    min-width: 32px;
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--glow);
    transition: width 0.8s linear;
    border-radius: 1px;
}

.progress-fill.urgent {
    background: var(--red);
    box-shadow: 0 0 6px rgba(255,68,68,0.5);
    animation: pulse-bar 0.5s ease infinite alternate;
}

@keyframes pulse-bar {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

.qr-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.qr-section-label {
    font-size: 13px;
    letter-spacing: 0.25em;
    color: var(--dim);
    align-self: flex-start;
}

.qr-wrapper {
    padding: 18px;
    background: #fff;
    border-radius: var(--radius);
    display: inline-block;
    line-height: 0;
}

body.theme-dark .qr-wrapper {
    background: #111;
    outline: 1px solid var(--border);
}

body.theme-dark .qr-wrapper canvas,
body.theme-dark .qr-wrapper img {
    filter: invert(1) hue-rotate(90deg) saturate(1.5);
}

.optional-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.optional-grid input[type="text"] {
    font-size: 15px;
    padding: 10px 12px;
}

.about-container {
    width: 100%;
    max-width: 540px;
    position: relative;
    z-index: 1;
}

.about-header {
    margin-bottom: 40px;
}

.about-title {
    font-family: var(--display);
    font-size: 54px;
    color: var(--accent);
    letter-spacing: 6px;
    text-shadow: 0 0 20px var(--glow);
    line-height: 1;
}

.about-subtitle {
    font-size: 14px;
    letter-spacing: 0.2em;
    color: var(--dim);
    margin-top: 8px;
}

.about-block {
    margin-bottom: 36px;
}

.about-block-title {
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--accent);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.about-block-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.about-block p,
.about-block li {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    opacity: 0.75;
    letter-spacing: 0.04em;
}

.about-block ul {
    list-style: none;
}

.about-block li {
    padding-left: 18px;
    position: relative;
    margin-bottom: 6px;
}

.about-block li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--accent);
    opacity: 0.7;
}

.about-block .code-line {
    font-size: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--accent);
    letter-spacing: 0.06em;
    display: inline-block;
    margin-top: 4px;
}

.about-warning {
    font-size: 14px;
    color: #e8a000;
    background: rgba(232, 160, 0, 0.06);
    border: 1px solid rgba(232, 160, 0, 0.2);
    border-radius: var(--radius);
    padding: 12px 14px;
    line-height: 1.7;
    margin-top: 10px;
    letter-spacing: 0.04em;
}

.about-warning::before { content: '⚠ '; }

.about-credit {
    font-size: 14px;
    color: var(--dim);
    letter-spacing: 0.15em;
    margin-top: 4px;
}

footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--border);
    font-size: 13px;
    letter-spacing: 0.2em;
    color: var(--dim);
    background: var(--bg);
    z-index: 1000;
}

@media (max-width: 600px) {
    body { padding: 50px 16px 70px; }

    .top-bar { padding: 0 16px; }
    .top-bar-status { display: none; }

    .totp-display { font-size: 72px; letter-spacing: 10px; }

    .optional-grid { grid-template-columns: 1fr; }

    .about-title { font-size: 42px; }
}