:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #8b5cf6;
    --card-bg: #1e293b;
    --card-hover: #334155;
    --divider-color: #334155;
    --error-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: rgba(15, 23, 42, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--divider-color);
}

.logo-area h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo-area h1 span {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.primary-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    font-family: inherit;
}

.primary-btn:hover {
    background: var(--primary-hover);
}

/* Main Content */
.portal-main {
    flex: 1;
}

.hero {
    text-align: center;
    padding: 5rem 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid var(--divider-color);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #94a3b8;
    max-width: 600px;
    margin: 0 auto;
}

/* Game Grid */
.game-library {
    padding: 4rem 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.game-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.game-card-bg {
    height: 160px;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    perspective: 600px;
}

.sudoku-bg {
    background: linear-gradient(45deg, #1e3a8a, #3b82f6);
}

/* SVG Animation for Sudoku Card */
.sudoku-anim-svg {
    width: 110px;
    height: 110px;
    animation: rotateBoard3D 30s linear infinite;
    opacity: 0.8;
    transform-style: preserve-3d;
}

.board-outline {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 2.5;
}

.board-line {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.5;
}

.cell-anim {
    fill: rgba(255, 255, 255, 0.85);
    transform-origin: center;
    transform-box: fill-box;
    animation: pulseCell 3s ease-in-out infinite alternate;
}

.game-card:hover .sudoku-anim-svg {
    animation: rotateBoard3D 10s linear infinite;
    opacity: 1;
}

@keyframes rotateBoard3D {
    0% {
        transform: rotateX(25deg) rotateY(0deg);
    }
    50% {
        transform: rotateX(-5deg) rotateY(180deg);
    }
    100% {
        transform: rotateX(25deg) rotateY(360deg);
    }
}

@keyframes pulseCell {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.cell-1 {
    animation-delay: 0s;
}

.cell-2 {
    animation-delay: 0.5s;
}

.cell-3 {
    animation-delay: 1.0s;
}

.cell-4 {
    animation-delay: 1.5s;
}

.cell-5 {
    animation-delay: 2.0s;
}

/* Simon Card Styles */
.simon-bg {
    background: radial-gradient(circle at center, #1a0033 0%, #05050f 100%);
}

.simon-anim-svg {
    width: 110px;
    height: 110px;
    animation: rotateBoard3D 25s linear infinite reverse;
    opacity: 0.8;
    transform-style: preserve-3d;
}

.game-card:hover .simon-anim-svg {
    animation: rotateBoard3D 8s linear infinite reverse;
    opacity: 1;
}

.simon-pulse {
    animation-duration: 2s;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}
.pulse-red { animation-name: pulse-red; animation-delay: 0s; }
.pulse-blue { animation-name: pulse-blue; animation-delay: 0.5s; }
.pulse-yellow { animation-name: pulse-yellow; animation-delay: 1.0s; }
.pulse-green { animation-name: pulse-green; animation-delay: 1.5s; }

@keyframes pulse-red { 0% { opacity: 0.3; } 100% { opacity: 1; filter: drop-shadow(0 0 5px #ff1053); } }
@keyframes pulse-blue { 0% { opacity: 0.3; } 100% { opacity: 1; filter: drop-shadow(0 0 5px #00d2ff); } }
@keyframes pulse-yellow { 0% { opacity: 0.3; } 100% { opacity: 1; filter: drop-shadow(0 0 5px #ffdf00); } }
@keyframes pulse-green { 0% { opacity: 0.3; } 100% { opacity: 1; filter: drop-shadow(0 0 5px #00ff66); } }

.game-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-card-content h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.game-card-content p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    flex: 1;
}

.play-btn {
    display: inline-block;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    transition: background 0.3s;
}

.game-card:hover .play-btn {
    background: var(--primary-color);
    color: #fff;
}

.coming-soon {
    opacity: 0.6;
    cursor: default;
    border-style: dashed;
}

.coming-soon:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--divider-color);
}

/* Auth Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-modal {
    background: var(--card-bg);
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--divider-color);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: #94a3b8;
    padding: 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.auth-body {
    padding: 2rem;
}

.social-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--divider-color);
    background: #fff;
    color: #333;
    font-family: inherit;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.social-btn:hover {
    background: #f8fafc;
}

.g-icon {
    font-weight: 800;
    font-size: 1.2em;
    color: #ea4335;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--divider-color);
    z-index: 1;
}

.auth-divider span {
    background: var(--card-bg);
    padding: 0 10px;
    color: #94a3b8;
    font-size: 0.85rem;
    position: relative;
    z-index: 2;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--divider-color);
    background: #0f172a;
    color: #fff;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 1.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 4px;
}

.newsletter-label {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.4;
    cursor: pointer;
}

.required-badge {
    background: var(--error-color);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: middle;
}

.terms-text {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

.auth-error {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.8rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border-left: 3px solid var(--error-color);
}

/* Footer */
.portal-footer {
    padding: 2rem 5%;
    text-align: center;
    border-top: 1px solid var(--divider-color);
    color: #64748b;
    font-size: 0.9rem;
}

.footer-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--divider-color);
    margin-top: auto;
}

.footer-link {
    color: #475569;
    text-decoration: none;
    font-size: 0.8rem;
    margin: 0 0.6rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #94a3b8;
}

.footer-sep {
    color: #1e293b;
    font-size: 0.8rem;
}

.footer-copy {
    color: #1e293b;
    font-size: 0.75rem;
    margin-top: 0.4rem;
}

/* Withdraw Section in Settings Modal */
.withdraw-section {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(239, 68, 68, 0.2);
}

.withdraw-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ef4444;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}

.withdraw-desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.withdraw-btn {
    width: 100%;
    padding: 0.65rem;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    color: #ef4444;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.withdraw-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}