* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'Cal Sans';
    src: url('../assets/fonts/CalSans-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Minisystem';
    src: url('../assets/fonts/Minisystem.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-bg: #2a2d3a;
    --secondary-bg: #323544;
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --shadow-light: #363952;
    --shadow-dark: #1e202b;
    --accent-color: #ffd700;
    --border-radius-sm: clamp(8px, 2vw, 12px);
    --border-radius-md: clamp(12px, 3vw, 16px);
    --border-radius-lg: clamp(15px, 4vw, 20px);
    --font-size-xs: clamp(8px, 2.5vw, 10px);
    --font-size-sm: clamp(10px, 3vw, 12px);
    --font-size-md: clamp(12px, 3vw, 14px);
    --font-size-lg: clamp(14px, 4vw, 16px);
    --font-size-xl: clamp(16px, 4vw, 18px);
    --font-size-xxl: clamp(16px, 5vw, 22px);
    --padding-sm: clamp(8px, 2vw, 12px);
    --padding-md: clamp(12px, 3vw, 18px);
    --padding-lg: clamp(12px, 3vw, 16px);
    --shadow-inset: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
    --shadow-outset: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    --shadow-card: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

body {
    font-family: "Cal Sans", sans-serif;
    letter-spacing: 0.02em;
    background: var(--primary-bg);
    color: var(--text-primary);
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom CSS property for mobile */
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    font-size: clamp(12px, 4vw, 18px);
}

/* Ensure form elements inherit the font */
button, input {
    font-family: inherit;
}

.mobile-app {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100); /* Use custom CSS property for mobile */
    background: var(--primary-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: clamp(12px, 3vw, 16px);
    margin: 0 auto;
    overflow: visible;
    box-sizing: border-box;
}

.status-container {
    background: var(--primary-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--padding-md);
    box-shadow: var(--shadow-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.status-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 12px);
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    outline: none;
    font-family: inherit;
}

.status-btn:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.status-btn:hover {
    color: var(--text-primary);
}

.status-left {
    display: flex;
    gap: clamp(6px, 1.5vw, 8px);
    align-items: center;
}

.live-status-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

.live-status-btn.recessed {
    color: var(--text-secondary);
}

.live-status-btn.recessed .live-dot {
    background: #22c55e;
}

.dark-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

.dark-btn.recessed {
    color: var(--text-primary);
}

.dark-btn.recessed .dark-dot {
    background: #000000;
}

.dark-dot {
    width: 4px;
    height: 4px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: background 0.15s ease;
}

.recessed {
    box-shadow: var(--shadow-inset);
}

.recessed:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.98);
}

.live-dot {
    width: 4px;
    height: 4px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: background 0.15s ease;
}

.status-links {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
}

.top-rate {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 8px;
}

/* Page Content Styles */
.page-content {
    background: var(--primary-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--padding-md);
    margin: var(--margin-md) 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--margin-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--padding-md);
    flex-shrink: 0;
}

.page-header h2 {
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: clamp(6px, 1.5vw, 8px);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    outline: none;
    width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.close-btn:hover {
    color: var(--text-primary);
}

.page-text {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-sm);
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    height: 88%;
    width: 82%;
}

.page-text::-webkit-scrollbar {
    display: none;
}

.page-text h3 {
    color: var(--text-primary);
    font-size: var(--font-size-md);
    font-weight: 600;
    margin: var(--margin-lg) 0 var(--margin-sm) 0;
}

.page-text p {
    margin: var(--margin-sm) 0;
}

.converter-container {
    flex: 1;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: visible; /* Allow shadows to show */
}

.display-container {
    background: var(--primary-bg);
    border-radius: var(--border-radius-sm);
    padding: var(--padding-md);
    box-shadow: var(--shadow-card);
    margin: clamp(4px, 1vw, 6px) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    gap: clamp(8px, 2vw, 12px);
}


.display-section {
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.6vw, 6px);
    position: relative;
    z-index: 3;
    min-height: clamp(80px, 30vw, 160px); /* Increased max from 120px to 180px */
}

.amount-display {
    flex: 1;
    border-radius: var(--border-radius-md);
    padding: clamp(4px, 1vw, 8px);
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 6px);
}

.amount-currency {
    font-size: var(--font-size-xxl);
    font-weight: 400;
    color: var(--text-primary);
    font-style: normal;
    letter-spacing: 0.02em;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    min-width: clamp(22px, 6vw, 30px);
    text-align: left;
}

.amount-currency.hidden {
    display: none;
}

.large-amount-input {
    flex: 1;
    background: none;
    border: none;
    box-shadow: none;
    font-size: var(--font-size-xxl);
    font-weight: 400;
    color: var(--text-primary);
    outline: none;
    text-align: left;
    font-style: normal;
    letter-spacing: 0.02em;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.quick-key {
    font-size: clamp(11px, 3vw, 13px);
    background: #3a3d4a;
    color: var(--text-primary);
}

.quick-key:active,
.quick-key.active,
.quick-key.pressed {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.currency-card {
    background: var(--primary-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--padding-md);
    box-shadow: var(--shadow-card);
    position: relative;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

.input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.currency-selector {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-sm);
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    min-width: clamp(70px, 20vw, 80px);
    position: relative;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-outset);
}

.currency-selector:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.98);
}

.currency-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-bg);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-card);
    z-index: 1000;
    margin-top: 4px;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.currency-dropdown.show {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.currency-option {
    padding: var(--padding-sm);
    cursor: pointer;
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.15s ease;
    border-radius: clamp(6px, 1.5vw, 8px);
    margin: 2px;
}

.currency-option:hover {
    background: var(--secondary-bg);
    box-shadow: 
        inset 1px 1px 2px var(--shadow-dark),
        inset -1px -1px 2px var(--shadow-light);
}

.currency-option.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 
        inset 1px 1px 2px rgba(0,0,0,0.2),
        inset -1px -1px 2px rgba(255,255,255,0.1);
}

.currency-selector-container {
    position: relative;
}

.amount-input {
    flex: 1;
    background: var(--secondary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-sm) clamp(10px, 3vw, 15px);
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    color: var(--text-primary);
    outline: none;
    text-align: right;
    box-shadow: var(--shadow-inset);
}

.amount-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.amount-input:focus {
    box-shadow: 
        inset 3px 3px 8px var(--shadow-dark),
        inset -3px -3px 8px var(--shadow-light),
        0 0 0 2px var(--primary-color);
}

.swap-container {
    display: flex;
    justify-content: center;
    margin: -10px 0;
    z-index: 10;
    position: relative;
}

.swap-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: 50%;
    width: clamp(40px, 12vw, 50px);
    height: clamp(40px, 12vw, 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    box-shadow: var(--shadow-outset);
}

.swap-btn:active {
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    transform: rotate(180deg) scale(0.95);
}

.convert-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-md);
    padding: clamp(10px, 3vw, 15px);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.convert-btn:active {
    box-shadow: 
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
    transform: scale(0.98);
}

.convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.convert-btn:hover::before {
    left: 100%;
}

.scrollable-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: visible; /* Allow shadows to show horizontally */
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 3vw, 15px);
    padding: clamp(8px, 2vw, 12px);
    padding-bottom: var(--padding-sm);
    margin: 0 clamp(-8px, -2vw, -12px); /* Negative margin to compensate for padding */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    /* Force hardware acceleration on mobile */
    transform: translateZ(0);
    will-change: scroll-position;
}

.scrollable-content::-webkit-scrollbar {
    display: none; /* WebKit */
}

/* New Display Section Styles */

.display-grid {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
    position: relative;
    z-index: 1;
}

.display-row {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    align-items: center;
}

.currency-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-md);
    padding: clamp(2px, 0.5vw, 3px) clamp(6px, 1.5vw, 8px);
    font-size: var(--font-size-md);
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    box-shadow: var(--shadow-outset);
    transition: all 0.2s ease;
    min-width: clamp(50px, 12vw, 70px);
    height: clamp(38px, 8vw, 42px);
    font-family: inherit;
}

.currency-btn:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.currency-btn.active {
    background: var(--secondary-bg);
    box-shadow: var(--shadow-inset);
    color: var(--text-primary);
}

.swap-btn-display {
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.swap-btn-display:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.rate-display-field {
    background: #1a1a1a;
    color: #00ff00;
    text-shadow: 0 0 4px #00ff00;
    font-size: clamp(14px, 3.5vw, 18px);
}

.amount-display-field {
    flex: 2;
    background: #000000;
    border: none;
    border-radius: var(--border-radius-md);
    padding: clamp(3px, 0.8vw, 4px) clamp(6px, 3vw, 16px);
    font-size: clamp(16px, 4.1vw, 22px);
    font-weight: 300;
    color: #ff3333;
    text-align: left;
    min-height: clamp(40px, 8vw, 44px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: 'Minisystem', monospace;
    letter-spacing: 0.02em;
    text-shadow: 0 0 4px #ff3333;
    border: 1px solid #161616;
    box-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.6),
        -2px -2px 3px rgba(255, 255, 255, 0.1);
}

.display-ad-section {
    width: calc((100% - 3 * 8px) / 4);
    flex-shrink: 0;
    /*background: url('background-image.png') center/cover, #1a1a1a;*/
    border-radius: var(--border-radius-sm);
    padding: var(--padding-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(84px, 10vw, 120px);
    overflow: hidden;
}

.ad-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in-out;
    text-align: center;
}

.ad-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.ad-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

.ad-title {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.ad-title-first {
    color: #1a73e8;
}

.ad-title-rest {
    color: #5f6368;
}

.ad-subtitle {
    font-size: 8px;
    font-weight: 500;
    color: #5f6368;
    line-height: 1;
}

.ad-cta {
    font-size: 8px;
    font-weight: 600;
    color: #ffffff;
    background: #1a73e8;
    padding: 2px 4px;
    border-radius: 2px;
    margin-top: 2px;
}

.keypad {
    background: var(--primary-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--padding-md);
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 8px;
}

.key {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-lg);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.key:active,
.key.pressed {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.key.operator {
    background: var(--primary-bg);
    color: var(--text-primary);
}

.key.operator:active {
    box-shadow: var(--shadow-inset);
}

.key.operator.currency-key {
    font-size: var(--font-size-sm);
    background: var(--primary-bg);
    color: var(--text-primary);
}

.key.operator.currency-swap-key {
    background: var(--primary-bg);
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.currency-key:active,
.currency-key.active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.history-key:active,
.history-key.active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

#recents-btn {
    font-size: 0; /* Hide the original text */
}

#recents-btn::before {
    content: '↺';
    display: inline-block;
    transform: rotate(-90deg);
    font-size: 20px;
}

.keypad-grid.currency-mode .key:not(.currency-key) {
    display: none;
}

.keypad-grid.currency-mode .currency-option-key {
    display: flex;
}

.keypad-grid.history-mode .key:not(.history-key) {
    display: none;
}

.keypad-grid.history-mode .history-key {
    display: flex;
}

.keypad-grid.history-mode .currency-option-key {
    display: none;
}

.keypad-grid.history-mode .history-option-key {
    display: flex;
}

.keypad-grid.history-mode .history-placeholder-key {
    display: flex;
}

.keypad-grid.history-mode {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
}


.currency-option-key {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    aspect-ratio: 1;
    display: none;
    align-items: center;
    justify-content: center;
}

.keypad-grid.currency-mode [class*="row"][class*="pos"] {
    display: flex;
}

.keypad-grid.currency-mode .row1-pos1 { grid-area: 1 / 1; }
.keypad-grid.currency-mode .row1-pos2 { grid-area: 1 / 2; }
.keypad-grid.currency-mode .row1-pos3 { grid-area: 1 / 3; }
.keypad-grid.currency-mode .row1-pos4 { grid-area: 1 / 4; }
.keypad-grid.currency-mode .row2-pos1 { grid-area: 2 / 1; }
.keypad-grid.currency-mode .row2-pos2 { grid-area: 2 / 2; }
.keypad-grid.currency-mode .row2-pos3 { grid-area: 2 / 3; }
.keypad-grid.currency-mode .row2-pos4 { grid-area: 2 / 4; }
.keypad-grid.currency-mode .row3-pos1 { grid-area: 3 / 1; }
.keypad-grid.currency-mode .row3-pos2 { grid-area: 3 / 2; }
.keypad-grid.currency-mode .row3-pos3 { grid-area: 3 / 3; }
.keypad-grid.currency-mode .row3-pos4 { grid-area: 3 / 4; }
.keypad-grid.currency-mode .row4-pos1 { grid-area: 4 / 1; }
.keypad-grid.currency-mode .row4-pos2 { grid-area: 4 / 2; }
.keypad-grid.currency-mode .row4-pos3 { grid-area: 4 / 3; }
.keypad-grid.currency-mode .row4-pos4 { grid-area: 4 / 4; }
.keypad-grid.currency-mode .row5-pos1 { grid-area: 5 / 1; }
.keypad-grid.currency-mode .row5-pos2 { grid-area: 5 / 2; }

.currency-option-key:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.placeholder-key {
    opacity: 0.6;
    cursor: pointer;
}

.placeholder-key:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.history-option-key {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-lg);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    aspect-ratio: 1;
    display: none;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.history-option-key:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.history-btn-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px;
    box-sizing: border-box;
}

.history-btn-from {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.history-btn-to {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.history-btn-time {
    font-size: 8px;
    color: var(--text-secondary);
    opacity: 0.6;
    line-height: 1;
}

.history-placeholder-key {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-lg);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: default;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-outset);
    aspect-ratio: 1;
    display: none;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.history-placeholder-text {
    font-size: 16px;
    color: var(--text-secondary);
    opacity: 0.6;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.recents-section {
    background: var(--primary-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--padding-md);
    box-shadow: var(--shadow-card);
    animation: slideIn 0.3s ease;
}

.recents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(15px, 4vw, 20px);
}

.recents-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.back-btn {
    background: var(--primary-bg);
    border: none;
    border-radius: 50%;
    width: clamp(24px, 8vw, 32px);
    height: clamp(24px, 8vw, 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}

.back-btn:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.recents-list {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 2vw, 10px);
    max-height: clamp(200px, 50vw, 300px);
    overflow-y: auto;
}

.recents-item {
    background: var(--secondary-bg);
    border-radius: var(--border-radius-sm);
    padding: clamp(10px, 3vw, 15px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-inset);
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

.recents-item:hover {
    background: var(--primary-bg);
    box-shadow: 
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.recents-conversion {
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.recents-meta {
    text-align: right;
}

.recents-time {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.recents-rate {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: 500;
}

.empty-recents {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    padding: clamp(20px, 6vw, 30px);
    font-style: italic;
}

.main-section {
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: visible; /* Allow shadows to show */
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.fade-out {
    animation: fadeOut 0.3s ease;
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.updating {
    animation: updatePulse 1s ease-in-out;
}

@keyframes updatePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; transform: scale(1.02); }
}

.history-list,
.recents-list {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.history-list::-webkit-scrollbar,
.recents-list::-webkit-scrollbar {
    display: none; /* WebKit */
}

.ad-placeholder {
    /*background: url('background-image.png') center/cover, #1a1a1a;*/
    border-radius: var(--border-radius-sm);
    padding: var(--padding-sm);
    margin: clamp(4px, 1vw, 6px) 0;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    min-height: clamp(90px, 25vw, 120px);
}

.main-ad-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

.ad-content-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 100%;
}

.ad-icon-main {
    font-size: 24px;
    flex-shrink: 0;
}

.ad-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ad-title-main {
    font-size: 14px;
    font-weight: 700;
    color: #1a73e8;
    line-height: 1.2;
}

.ad-subtitle-main {
    font-size: 11px;
    font-weight: 400;
    color: #5f6368;
    line-height: 1.3;
}

.ad-cta-main {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    background: #1a73e8;
    padding: 6px 12px;
    border-radius: 4px;
    flex-shrink: 0;
    text-align: center;
    min-width: 70px;
}

.ad-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 60px;
}

.main-ad-carousel .ad-slide {
    min-height: 60px;
}

.ad-label {
    background: #1a73e8;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ad-text {
    color: #e3e3e3;
    font-size: var(--font-size-sm);
    font-weight: 400;
}

/* Advertise Form Styles */
.advertise-form {
    max-width: 100%;
    margin: 0;
    padding: 0 6px;
}

.form-group {
    margin-bottom: var(--padding-md);
    display: flex;
    align-items: center;
    gap: var(--padding-sm);
}

.form-group label {
    color: var(--text-primary);
    font-size: var(--font-size-md);
    font-weight: 600;
    min-width: 80px;
    text-align: left;
    flex-shrink: 0;
}

.form-group input {
    flex: 1;
    background: var(--secondary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--padding-sm);
    font-size: var(--font-size-md);
    color: var(--text-primary);
    box-shadow: var(--shadow-inset);
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus {
    box-shadow: 
        inset 3px 3px 8px var(--shadow-dark),
        inset -3px -3px 8px var(--shadow-light),
        0 0 0 2px var(--primary-color);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.pricing-options {
    display: flex;
    flex-direction: row;
    gap: var(--padding-lg);
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: var(--padding-sm);
    transition: all 0.15s ease;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-button {
    width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-outset);
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-button {
    box-shadow: var(--shadow-inset);
}

.radio-option input[type="radio"]:checked + .radio-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--primary-color);
}

.radio-option:hover .radio-button {
    transform: scale(0.95);
}

.radio-label {
    color: var(--text-primary);
    font-size: var(--font-size-md);
    font-weight: 500;
}

.pay-button {
    background: var(--primary-bg);
    border: none;
    border-radius: var(--border-radius-md);
    padding: var(--padding-md) var(--padding-lg);
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-outset);
    outline: none;
    margin-top: var(--padding-lg);
    font-family: inherit;
    width: 100%;
}

.pay-button:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.98);
}

.pay-button:hover {
    color: var(--primary-color);
}

@media (hover: none) and (pointer: coarse) {
    .quick-btn:active,
    .swap-btn:active,
    .convert-btn:active,
    .key:active,
    .currency-option-key:active {
        transform: scale(0.95);
    }
}

.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
    animation: loading 1.5s infinite;
    transform: translateX(-100%);
}

@keyframes loading {
    to { transform: translateX(100%); }
}