:root {
    --clr-bg:               #0C0A09;
    --clr-surface:          #1C1917;
    --clr-border:           #292524;
    --clr-text:             #FAFAF9;
    --clr-text-muted:       #A8A29E;
    --clr-placeholder:      #44403C;
    --clr-separator:        #292524;
    --clr-primary:          #7C3AED;
    --clr-primary-tab-bg:   #2E1065;
    --clr-primary-inactive: #A78BFA;
    --clr-toggle-bg:        #292524;
    --clr-toggle-inactive:  #78716C;
    --clr-paste-bg:         #3B0764;
    --clr-paste-text:       #C4B5FD;
    --clr-cipher-bg:        #1C1917;
    --clr-cipher-border:    #292524;
    --clr-cipher-text:      #A8A29E;
    --clr-success-bg:       #052E16;
    --clr-success-border:   #166534;
    --clr-success-text:     #ECFDF5;
    --clr-success-copy-bg:  #052E16;
    --clr-success-copy-txt: #4ADE80;
}

:root.theme-light {
    --clr-bg:               #F5F5F4;
    --clr-surface:          #FFFFFF;
    --clr-border:           #E7E5E4;
    --clr-text:             #1C1917;
    --clr-text-muted:       #78716C;
    --clr-placeholder:      #C7C4C1;
    --clr-separator:        #E7E5E4;
    --clr-primary:          #7C3AED;
    --clr-primary-tab-bg:   #EDE9FE;
    --clr-primary-inactive: #7C3AED;
    --clr-toggle-bg:        #F5F5F4;
    --clr-toggle-inactive:  #78716C;
    --clr-paste-bg:         #EDE9FE;
    --clr-paste-text:       #7C3AED;
    --clr-cipher-bg:        #FAFAF9;
    --clr-cipher-border:    #D6D3D1;
    --clr-cipher-text:      #57534E;
    --clr-success-bg:       #F0FDF4;
    --clr-success-border:   #BBF7D0;
    --clr-success-text:     #14532D;
    --clr-success-copy-bg:  #DCFCE7;
    --clr-success-copy-txt: #16A34A;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Tahoma, sans-serif;
}

body {
    min-height: 100dvh;
    background: radial-gradient(ellipse 110% 110% at 50% 50%, #0f0523 0%, #07010f 55%, #020008 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: var(--clr-text);
}

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s;
}

:root.theme-light body {
    background: radial-gradient(ellipse 110% 110% at 50% 50%, #ede9fe 0%, #f3f0ff 55%, #eee9ff 100%);
}

:root.theme-light #bgCanvas {
    opacity: 0.9;
}

.app-container {
    width: 100%;
    max-width: 430px;
    height: 100dvh;
    background: var(--clr-bg);
    display: grid;
    grid-template-rows: 56px 1fr 72px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.18),
        0 0 60px rgba(88, 28, 135, 0.35),
        0 8px 80px rgba(0, 0, 0, 0.7);
    transition: background 0.2s;
}

.app-container.about-page {
    grid-template-rows: 56px 1fr;
}

:root.theme-light .app-container {
    box-shadow:
        0 0 0 1px rgba(124, 58, 237, 0.12),
        0 0 40px rgba(124, 58, 237, 0.12),
        0 8px 60px rgba(0, 0, 0, 0.15);
}

.app-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-separator);
    flex-shrink: 0;
}

.app-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--clr-text);
}

.about-title {
    font-size: 18px;
    text-align: center;
    grid-column: 2;
}

.theme-toggle-wrap {
    display: flex;
    gap: 2px;
    background: var(--clr-toggle-bg);
    border-radius: 10px;
    padding: 3px;
}

.theme-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    color: var(--clr-toggle-inactive);
    transition: background 0.15s, color 0.15s;
}

.theme-btn.active {
    background: var(--clr-primary);
    color: #ffffff;
}

.btn-about {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-toggle-bg);
    border-radius: 10px;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-about:hover { opacity: 0.8; }

.btn-back {
    font-size: 14px;
    font-weight: 600;
    color: var(--clr-primary-inactive);
    text-decoration: none;
    padding: 6px 4px;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.btn-back:hover { opacity: 0.8; }

.panel {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    min-height: 0;
}

.panel[hidden] {
    display: none !important;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.panel-section--3 { flex: 3; }
.panel-section--2 { flex: 2; }

.field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.field-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--clr-text-muted);
}

.action-btn {
    padding: 7px 14px;
    background: var(--clr-paste-bg);
    color: var(--clr-paste-text);
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.action-btn:hover { opacity: 0.85; }

.action-btn--success {
    background: var(--clr-success-copy-bg);
    color: var(--clr-success-copy-txt);
}

.action-btn--password {
    height: 48px;
    border-radius: 13px;
    padding: 0 16px;
}

.editor-wrap {
    flex: 1;
    min-height: 0;
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-border);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
}

.editor-wrap--cipher {
    background: var(--clr-cipher-bg);
    border-color: var(--clr-cipher-border);
}

.editor-wrap--success {
    background: var(--clr-success-bg);
    border-color: var(--clr-success-border);
}

.editor {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--clr-text);
    line-height: 1.6;
}

.editor::placeholder { color: var(--clr-placeholder); }

.editor--cipher {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: var(--clr-cipher-text);
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.editor--success {
    color: var(--clr-success-text);
}

.panel-middle {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.password-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.input-wrap {
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-border);
    border-radius: 13px;
    height: 48px;
    padding: 0 14px;
    display: flex;
    align-items: center;
}

.input-field {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    background: transparent;
    color: var(--clr-text);
}

.input-field::placeholder { color: var(--clr-placeholder); }

.primary-btn {
    width: 100%;
    padding: 14px 0;
    background: var(--clr-primary);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    position: relative;
}

.primary-btn:hover  { opacity: 0.9; }
.primary-btn:active { transform: scale(0.985); }

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.primary-btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    top: 50%;
    right: 20px;
    margin-top: -9px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.app-tabbar {
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-separator);
    padding: 7px 14px;
    display: flex;
    align-items: center;
}

.tab-container {
    width: 100%;
    background: var(--clr-primary-tab-bg);
    border-radius: 15px;
    padding: 4px;
    margin-top: 3px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.tab-btn {
    padding: 13px 0;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: transparent;
    color: var(--clr-primary-inactive);
}

.tab-btn.active {
    background: var(--clr-primary);
    color: #ffffff;
}

.toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 25, 23, 0.88);
    color: #FAFAF9;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.18s;
}

.toast.visible { opacity: 1; }

.about-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-border);
    border-radius: 16px;
    padding: 20px;
}

.card--hero {
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
}

.hero-app-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--clr-text);
}

.hero-version {
    font-size: 13px;
    color: var(--clr-text-muted);
    margin-top: 4px;
}

.hero-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 14px 0;
}

.hero-desc {
    font-size: 14px;
    line-height: 1.7;
    color: var(--clr-text-muted);
}

.card-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--clr-text-muted);
    margin-bottom: 10px;
}

.card-value {
    font-size: 15px;
    color: var(--clr-text);
    line-height: 1.6;
}

.platform-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.platform-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--clr-primary-tab-bg);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
}

.platform-item--link {
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.platform-item--link:hover {
    opacity: 0.82;
    transform: translateY(-1px);
}

.platform-item--soon {
    opacity: 0.55;
    cursor: default;
}

.platform-icon {
    font-size: 22px;
    line-height: 1;
    width: 28px;
    text-align: center;
}

.platform-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.platform-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--clr-text);
}

.platform-sub {
    font-size: 11px;
    color: var(--clr-primary-inactive);
}

.platform-arrow {
    font-size: 15px;
    color: var(--clr-primary-inactive);
    flex-shrink: 0;
}

.platform-badge {
    font-size: 15px;
    flex-shrink: 0;
}

.donation-hint {
    font-size: 13px;
    line-height: 1.55;
    color: var(--clr-text-muted);
    margin: 0 0 12px;
}

.donation-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--clr-primary-tab-bg);
    border-radius: 12px;
}

.donation-address {
    flex: 1 1 180px;
    font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', monospace;
    font-size: 11px;
    line-height: 1.5;
    word-break: break-all;
    color: var(--clr-text);
    background: transparent;
}

.btn-donation-copy {
    flex-shrink: 0;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--clr-primary);
    color: #ffffff;
    transition: opacity 0.15s;
}

.btn-donation-copy:hover {
    opacity: 0.9;
}

::-webkit-scrollbar          { width: 4px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--clr-border); border-radius: 2px; }
