:root {
    --primary-blue: #4c6ef5;
    --primary-gradient: linear-gradient(135deg, #4481eb 0%, #04befe 100%);
    --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-light: #F8F9FA;
    --white: #FFFFFF;
    --text-dark: #1F2937;
    --text-grey: #9CA3AF;
    --accent-color: #4F46E5;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #e0e0e0;
    /* Outer background */
    color: var(--text-dark);
    min-height: 100vh;
}

/* Mobile Wrapper/Container */
.mobile-wrapper {
    display: flex;
    justify-content: center;
    background: #e0e0e0;
    min-height: 100vh;
}

.mobile-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-light);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Header Section */
.app-header {
    background: var(--primary-gradient);
    color: var(--white);
    padding: 40px 24px 80px;
    /* Extra bottom padding for overlap */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    position: relative;
    z-index: 1;
}

.user-profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-large {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.greeting-text {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}

.username-display {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.header-logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.header-logout-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.header-update-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    backdrop-filter: blur(4px);
    height: 40px;
    /* Match logout button */
}

.header-update-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-update-btn:active {
    transform: scale(0.95);
}

/* Content Sheet */
.content-sheet {
    background: var(--bg-light);
    margin-top: -40px;
    /* Overlap effect */
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    padding: 30px 20px 40px;
    flex: 1;
    z-index: 10;
    position: relative;
}



/* Transaction List */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Card Style */
.transaction-item {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Stacked layout */
    gap: 12px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: transform 0.2s;
}

.transaction-item:active {
    transform: scale(0.98);
}

.item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-icon-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #EEF2FF;
    color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.item-info {
    flex: 1;
}

.item-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.item-expiry {
    font-size: 12px;
    color: var(--text-grey);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Emphasized Code Section */
.item-code-container {
    background: #F3F4F6;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: text;
    border: 1px dashed #D1D5DB;
    position: relative;
    overflow: hidden;
    /* Block centering */
    width: 80%;
    margin: 12px auto 0;
    align-self: center;

    /* Content centering */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Active Campaign Style */
.item-code-container.active-code {
    background: #EEF2FF;
    border: 1px dashed #818CF8;
}

.item-code {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-align: center;
    /* Explicitly center text */
    width: 100%;
    /* Ensure full width for centering */
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: hidden;
    /* Hide overflow */
    display: inline-block;
    /* Allow size calculation */
}


/* Expired State */
.transaction-item.expired {
    opacity: 0.7;
}

.expired .item-code {
    color: #EF4444;
    text-decoration: line-through;
}

.expired .item-code-container {
    background: #FEF2F2;
    border-color: #FECACA;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 200;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.login-overlay.active {
    display: flex;
}

.login-logo {
    max-width: 500px;
    /* Limit PC size */
    width: 100%;
    /* Maintain mobile padding */
    height: auto;
    margin-bottom: 24px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-content h1 {
    color: #000000;
    /* Changed to Black */
    margin-bottom: 4px;
    font-size: 28px;
    font-weight: 800;
}

.subtitle-jp {
    font-size: 28px;
    /* Matched to Title size */
    color: #000000;
    /* Matched to Title color */
    font-weight: 800;
    margin-bottom: 32px;
}

.btn-discord-large {
    background: #5865F2;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(88, 101, 242, 0.3);
    transition: transform 0.2s;
    width: 100%;
    justify-content: center;
    max-width: 300px;
    margin: 16px auto 0;
    /* Force center */
}

.btn-discord-large:hover {
    transform: translateY(-2px);
    background: #4752C4;
}

/* Loading */
.loading-spinner {
    display: none;
    justify-content: center;
    padding: 40px;
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #E5E7EB;
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

.mobile-wrapper {
    display: flex;
    justify-content: center;
    background: #e0e0e0;
    min-height: 100vh;
}

.mobile-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-light);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Header Section */
.app-header {
    background: var(--primary-blue);
    color: var(--white);
    padding: 24px 24px 40px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.user-profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Center align vertically */
    margin-bottom: 0;
}

.user-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.greeting-text {
    font-size: 11px;
    opacity: 0.9;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.username-display {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.header-logout-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    /* Slightly rounded square */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}

.header-logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.action-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--white);
    flex: 1;
}

.icon-circle {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background 0.2s;
    backdrop-filter: blur(5px);
}

.action-btn:active .icon-circle {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.action-btn span {
    font-size: 12px;
    font-weight: 500;
}

/* Content Sheet (Main Card) */
.content-sheet {
    background: var(--bg-light);
    margin-top: -24px;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 24px 20px 40px;
    flex: 1;
    z-index: 10;
    min-height: 400px;
    /* Ensure whitespace */
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sheet-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.see-all-btn {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Transaction (Exchange Code) List */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* More space between cards */
}

.transaction-item {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    /* Gap between separate rows inside card */
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.3s ease-out forwards;
    border: 1px solid #E5E7EB;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.t-icon {
    display: none;
    /* User didn't ask for icon remove explicitly but "Vertical list" often implies simple text stack. Let's hide it to save space or re-layout. Actually user said "Display items (Name, Code, Expiry) all vertical". Icon is decoration. I'll hide it to reduce noise. */
}

.t-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.t-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    margin: 0;
}

.t-subtitle {
    /* This is the Expiry */
    font-size: 13px;
    color: var(--text-grey);
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-start;
    /* Left align */
    margin: 0;
}

.t-amount {
    /* This is the Code */
    width: 100%;
    text-align: center;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    /* Larger code */
    color: var(--primary-blue);
    background: #EEF2FF;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    /* Space above code */
    letter-spacing: 1px;
    border: 1px dashed #C7D2FE;
    transition: transform 0.1s;
}

.t-amount:active {
    transform: scale(0.98);
}

.expired .t-amount {
    color: #DC2626;
    background: #FEE2E2;
    border-color: #FECACA;
}

.expired .t-icon {
    background: #FEE2E2;
    color: #DC2626;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 200;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.login-overlay.active {
    display: flex;
}


.btn-discord-large {
    background: #5865F2;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(88, 101, 242, 0.3);
    transition: transform 0.2s;
    width: 100%;
    justify-content: center;
    max-width: 300px;
}

.btn-discord-large:hover {
    transform: translateY(-2px);
    background: #4752C4;
}

/* Loading */
.loading-spinner {
    display: none;
    justify-content: center;
    padding: 20px;
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #E5E7EB;
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}



/* Logout Modal */
.logout-modal-content {
    text-align: center;
    padding: 30px 24px;
}

.logout-modal-content h3 {
    margin-bottom: 12px;
    font-size: 20px;
    color: var(--text-dark);
}

.logout-modal-content p {
    color: var(--text-grey);
    margin-bottom: 24px;
}

.logout-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-cancel,
.btn-confirm {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
    border: none;
    transition: transform 0.1s;
}

.btn-cancel {
    background: #F3F4F6;
    color: var(--text-dark);
}

.btn-confirm {
    background: #EF4444;
    color: white;
}

.btn-cancel:active,
.btn-confirm:active {
    transform: scale(0.95);
}

.guide-image {
    width: 100%;
    border-radius: 8px;
}

.image-caption {
    font-size: 13px;
    color: #555;
    margin-top: 10px;
    line-height: 1.5;
}