/* ===== ULF Tic-Tac-Toe Styles ===== */

/* Utility layout classes */
.max-w-4xl {
    max-width: 56rem;
}
.mx-auto {
    margin-left: auto;
    margin-right: auto;
}
.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}
.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.pt-3 {
    padding-top: 0.75rem;
}
.mb-3 {
    margin-bottom: 0.75rem;
}
.mt-4 {
    margin-top: 1rem;
}
.mt-8 {
    margin-top: 2rem;
}
.flex-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.grid {
    display: grid;
}
.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.gap-2 {
    gap: 0.5rem;
}
.underline {
    text-decoration: underline;
}

/* Theme shells */
:root {
    color-scheme: light;
}
.theme-dark {
    color-scheme: dark;
}

/* Base */
html,
body {
    height: 100%;
}
body {
    background: #f8fafc;
    color: #0f172a;
    font-family:
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Ubuntu,
        Cantarell,
        Noto Sans,
        Arial,
        "Apple Color Emoji",
        "Segoe UI Emoji";
}
.theme-dark body {
    background: #020617;
    color: #e2e8f0;
}

/* Header */
.header-blur {
    background: rgba(248, 250, 252, 0.85);
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(6px);
}
.theme-dark .header-blur {
    background: rgba(2, 6, 23, 0.7);
    border-bottom: 1px solid #1e293b;
}
.logo {
    height: 2rem;
    width: 2rem;
    border-radius: 0.5rem;
}
.title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.subtitle {
    margin: 0;
    opacity: 0.7;
    font-size: 0.75rem;
}
.nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn,
.btn-secondary,
.btn-tertiary,
.btn-premium,
select.btn-tertiary {
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.btn {
    background: #0284c7;
    color: #fff;
    border-color: #0369a1;
}
.btn:hover {
    background: #0ea5e9;
}
.btn:active {
    background: #0369a1;
}
.btn-secondary {
    background: #e5e7eb;
    color: #0f172a;
    border-color: #cbd5e1;
}
.btn-secondary:hover {
    background: #cbd5e1;
}
.btn-secondary:active {
    background: #94a3b8;
}
.theme-dark .btn-secondary {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #334155;
}
.theme-dark .btn-secondary:hover {
    background: #334155;
}
.theme-dark .btn-secondary:active {
    background: #0f172a;
}
.btn-tertiary,
select.btn-tertiary {
    background: transparent;
    border-color: #cbd5e1;
}
.theme-dark .btn-tertiary,
.theme-dark select.btn-tertiary {
    border-color: #334155;
}
.btn-premium {
    background: #111827;
    color: #e5e7eb;
    border-color: #1f2937;
}
.btn-premium:hover {
    background: #0f172a;
}

/* Status & footer */
.status {
    font-size: 0.875rem;
}
.user-area {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.85;
}
.footer {
    padding: 2rem 0;
    text-align: center;
    font-size: 0.75rem;
    opacity: 0.75;
}

/* Board */
.board-wrap {
    border-radius: 1rem;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid #e2e8f0;
    padding: 0.5rem;
}
.theme-dark .board-wrap {
    background: rgba(2, 6, 23, 0.6);
    border-color: #1e293b;
}
.cell {
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    border-radius: 1rem;
    background: #e5e7eb;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    user-select: none;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}
.cell:hover {
    background: #cbd5e1;
}
.cell:active {
    background: #94a3b8;
}
.theme-dark .cell {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #334155;
}
.theme-dark .cell:hover {
    background: #334155;
}
.theme-dark .cell:active {
    background: #0f172a;
}
@media (min-width: 768px) {
    .cell {
        font-size: 3rem;
    }
}
.cell.winner {
    background: rgba(4, 120, 87, 0.12);
    border-color: #047857;
}
.theme-dark .cell.winner {
    background: rgba(4, 120, 87, 0.35);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
}
.theme-dark .badge {
    border-color: #1e293b;
    background: #0b1220;
    color: #e5e7eb;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 50;
}
.modal.hidden {
    display: none;
}
.modal-card {
    width: 100%;
    max-width: 26rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
}
.theme-dark .modal-card {
    border-color: #1e293b;
    background: #0b1220;
    color: #e5e7eb;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.theme-dark .modal-header {
    border-color: #1e293b;
}
.modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.field input {
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
}
.theme-dark .field input {
    border-color: #334155;
    background: #111827;
    color: #e5e7eb;
}
.small {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* Simple utility for images */
img {
    max-width: 100%;
    height: auto;
}

/* --- Auth modal polish --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Label text above inputs */
.field > span {
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 0.25rem;
    display: inline-block;
}
.theme-dark .field > span {
    color: #94a3b8;
}

/* Inputs */
.field input {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border-radius: 0.6rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02) inset;
}
.field input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}
.theme-dark .field input {
    border-color: #334155;
    background: #0b1220;
    color: #e5e7eb;
}
.theme-dark .field input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

/* Buttons row */
.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.modal-actions .btn,
.modal-actions .btn-secondary {
    flex: 1 1 0;
}

/* Legal blurb spacing */
.legal {
    margin-top: 0.5rem;
    text-align: center;
}

/* Auth tabs */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.auth-tab {
    flex: 1 1 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
}
.auth-tab.is-active {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}
.theme-dark .auth-tab {
    border-color: #334155;
    background: #0b1220;
    color: #e5e7eb;
}
.theme-dark .auth-tab.is-active {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

/* Password show/hide */
.password-wrap {
    position: relative;
    display: flex;
}
.password-wrap input {
    width: 100%;
    padding-right: 2.25rem;
}
.password-wrap .peek {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #64748b;
}
.password-wrap .peek:hover {
    color: #0f172a;
}
.theme-dark .password-wrap .peek:hover {
    color: #e2e8f0;
}
