* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --surface: #131313;
    --surface-dim: #131313;
    --surface-bright: #393939;
    --surface-container-lowest: #0e0e0e;
    --surface-container-low: #1c1b1b;
    --surface-container: #20201f;
    --surface-container-high: #2a2a2a;
    --surface-container-highest: #353534;
    --on-surface: #e5e2e1;
    --on-surface-variant: #c4c7c7;
    --outline: #8e9192;
    --outline-variant: #4c4546;
    --primary: #e2e2e2;
    --on-primary: #2f3131;
    --primary-container: #c6c6c6;
    --secondary: #c6c6c7;
    --on-secondary: #2f3131;
    --secondary-container: #454747;
    --tertiary: #dce1ff;
    --on-tertiary: #00277f;
    --tertiary-container: #b6c4ff;
    --on-tertiary-container: #3368ff;
    --error: #ffb4ab;
    --gutter: 4px;
    --tile-padding: 12px;
    --header-height: 44px;
    --footer-height: 50px;
}

body {
    margin: 0;
    background-color: var(--surface);
    color: var(--on-surface);
    font-family: 'Hanken Grotesk', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
}

.header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 375px;
    height: var(--header-height);
    background-color: var(--surface-container-low);
    border-bottom: 1px solid var(--outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--tile-padding);
    z-index: 999;
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
}

.header-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    background-color: var(--surface-container-high);
    border: 1px solid var(--outline-variant);
    color: var(--error);
}

.header-status.active {
    color: #3368ff;
    border-color: #3368ff;
}

.help-icon {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 500;
    color: var(--on-surface-variant);
    cursor: pointer;
    padding: 4px;
    border: 1px solid var(--outline-variant);
}

.content {
    position: relative;
    width: 375px;
    margin-left: calc(50% - 187.5px);
    margin-top: calc(var(--header-height) + var(--gutter));
    padding: var(--gutter);
    padding-bottom: calc(var(--footer-height) + var(--gutter) + 20px);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gutter);
}

.tile {
    background-color: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    padding: var(--tile-padding);
}

.tile-1x1 { grid-column: span 1; grid-row: span 1; }
.tile-1x2 { grid-column: span 1; grid-row: span 2; }
.tile-2x1 { grid-column: span 2; grid-row: span 1; }
.tile-2x2 { grid-column: span 2; grid-row: span 2; }
.tile-1x3 { grid-column: span 2; grid-row: span 1; }

.tile-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
    margin-bottom: 8px;
}

.brand-tile {
    background-color: var(--surface-container);
    display: flex;
    flex-direction: column;
}

.brand-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--primary);
    margin-bottom: 4px;
}

.brand-metrics {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background-color: rgb(212 175 55);
    border: 1px solid rgb(212 175 55);
}

.metric-item .material-symbols-outlined {
    font-size: 16px;
    color: #0c0c0c;
}

.metric-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #0c0c0c;
}

.gold-text-gradient {
    background: linear-gradient(135deg, #d4af37 0%, #f4e5a1 50%, #d4af37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gold-gradient {
    background: linear-gradient(135deg, #fbf2d5 0%, #d4af37 50%, #aa8a2e 100%);
}

.btn-bounce {
    animation: soft-bounce 2s infinite ease-in-out;
}

@keyframes soft-bounce {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 10px 25px -5px rgba(212, 175, 55, 0.4); 
    }
    50% { 
        transform: scale(1.03); 
        box-shadow: 0 20px 35px -5px rgba(212, 175, 55, 0.6); 
    }
}

.glass-dark {
    background: #1a1a1a;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.section-title {
    margin-bottom: 12px;
}

.chakra-symbol-1 {
    position: absolute;
    right: -25px;
    bottom: -30px;
    font-size: 3.75rem;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.chakra-symbol-2 {
    position: absolute;
    right: -5px;
    bottom: -10px;
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.chakra-symbol-3 {
    position: absolute;
    right: 0px;
    bottom: -5px;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.chakra-symbol-4 {
    position: absolute;
    right: 0px;
    bottom: -5px;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.chakra-symbol-5 {
    position: absolute;
    right: -5px;
    bottom: -10px;
    font-size: 4.5rem;
    color: rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.chakra-symbol-6 {
    position: absolute;
    right: -5px;
    bottom: -10px;
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 2px solid var(--outline-variant);
    border-top: 2px solid #3368ff;
    animation: spin 1s linear infinite;
    z-index: 1000;
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.score-card {
    background: linear-gradient(135deg, #d4af3722 0%, #aa8a2e22 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.score-label {
    font-family: 'JetBrains Mono', monospace;
}

.score-value {
    font-family: 'JetBrains Mono', monospace;
}

.stroke-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.stroke-char {
    font-size: 22px;
    font-weight: bold;
    color: var(--on-surface);
    margin-bottom: 4px;
}

.stroke-count {
    font-size: 13px;
    background: linear-gradient(135deg, #d4af37 0%, #aa8a2e 100%);
    color: #0c0c0c;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 4px;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

.theorem-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.theorem-info {
    flex: 1;
}

.theorem-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.theorem-number {
    font-size: 13px;
    color: #d4af37;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
}

.theorem-level {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
}

.theorem-name {
    font-size: 14px;
    color: var(--on-surface);
    margin-bottom: 4px;
    font-weight: 500;
}

.theorem-desc {
    font-size: 11px;
    color: var(--on-surface-variant);
    margin-bottom: 6px;
    line-height: 1.5;
}

.theorem-examples {
    font-size: 10px;
    color: #8e9192;
    font-family: 'JetBrains Mono', monospace;
}

.theorem-conclusion {
    font-size: 11px;
    color: #d4af37;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(212, 175, 55, 0.2);
}

.theorem-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.theorem-status.passed {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.theorem-status.failed {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.result-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.result-modal-overlay.show {
    display: flex;
}

.result-modal {
    background: #1a1a1a;
    border-top: 2px solid #d4af37;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 375px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.result-modal-overlay.show .result-modal {
    transform: translateY(0);
}

.result-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    position: sticky;
    top: 0;
    background: #1a1a1a;
    z-index: 1;
}

.result-modal-content {
    padding: 16px;
}

#closeModalBtn {
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 375px) {
    body, .header, .content, .result-modal {
        width: 100%;
    }
}