/* ========================================
   CURRENCY CONVERTER - JAPANESE RECEIPT STYLE
   Based on KUPANI restaurant design
   ======================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&family=Inter:wght@400;600;700;900&display=swap');

/* CSS Variables */
:root {
    --red-bg: #e63326;
    --cream: #f5f0e1;
    --cream-dark: #e8e0c8;
    --black: #1a1a1a;
    --yellow: #f7c948;
    --yellow-dark: #d4a82a;
    --grid-line: rgba(255, 255, 255, 0.15);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--red-bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    
    /* Grid pattern */
    background-image: 
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Container */
.container {
    width: 100%;
    max-width: 400px;
    position: relative;
}

/* Chopsticks decoration */
.chopsticks {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 60px;
    z-index: 10;
}

.chopstick {
    position: absolute;
    width: 180px;
    height: 8px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 50%, #3a3a3a 100%);
    border-radius: 4px;
    transform-origin: right center;
}

.chopstick:first-child {
    top: 15px;
    left: 10px;
    transform: rotate(-8deg);
}

.chopstick:nth-child(2) {
    top: 30px;
    left: 10px;
    transform: rotate(5deg);
}

/* Main Card - Receipt Style */
.converter-card {
    background: var(--cream);
    border-radius: 4px;
    padding: 40px 30px 30px;
    position: relative;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 2px 10px rgba(0, 0, 0, 0.2);
    
    /* Paper texture effect */
    background-image: 
        linear-gradient(var(--cream) 0%, var(--cream-dark) 100%);
}

/* Torn paper edge effect at bottom */
.converter-card::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--cream-dark);
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0 Q5 10 10 0 Q15 10 20 0 Q25 10 30 0 Q35 10 40 0 Q45 10 50 0 Q55 10 60 0 Q65 10 70 0 Q75 10 80 0 Q85 10 90 0 Q95 10 100 0 L100 10 L0 10Z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0 Q5 10 10 0 Q15 10 20 0 Q25 10 30 0 Q35 10 40 0 Q45 10 50 0 Q55 10 60 0 Q65 10 70 0 Q75 10 80 0 Q85 10 90 0 Q95 10 100 0 L100 10 L0 10Z'/%3E%3C/svg%3E");
    mask-size: 20px 100%;
    -webkit-mask-size: 20px 100%;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 25px;
}

.title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.title-main {
    font-family: 'Dela Gothic One', cursive;
    font-size: 2.2rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 5px;
}

.subtitle {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 10px;
}

.subtitle-jp {
    font-size: 0.75rem;
    color: #666;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* Divider */
.divider {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 20px 0;
}

.divider-line {
    height: 3px;
    background: var(--black);
    border-radius: 2px;
}

.divider-line:nth-child(2) {
    height: 2px;
}

/* Hero: amount + currency — same design language as table + Random button */
.hero-panel {
    margin-top: 8px;
    margin-bottom: 18px;
    padding: 16px 8px 12px;
}

.hero-panel-topline {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 14px;
}

.hero-panel-topline .divider-line {
    height: 3px;
    background: var(--black);
    border-radius: 2px;
}

.hero-panel-topline .divider-line:nth-child(2) {
    height: 2px;
}

.hero-label {
    font-family: 'Dela Gothic One', cursive;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--black);
    text-align: center;
}

.hero-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    justify-content: center;
}

.hero-field {
    flex: 1 1 140px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hero-field-label {
    font-weight: 900;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--black);
    padding-left: 2px;
}

.hero-input {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 900;
    padding: 12px 14px;
    border: 3px solid var(--black);
    border-radius: 8px;
    background: var(--cream);
    color: var(--black);
    text-align: right;
    box-shadow: 4px 4px 0 var(--black);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-input:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--black);
}

.hero-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 4px 4px 0 var(--red-bg);
}

.hero-input::-webkit-outer-spin-button,
.hero-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hero-select-wrap {
    position: relative;
    width: 100%;
}

.hero-select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--black);
    transform: translateY(-40%);
    pointer-events: none;
    z-index: 1;
}

.hero-select {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 36px 12px 14px;
    border: 3px solid var(--black);
    border-radius: 8px;
    background: var(--yellow);
    color: var(--black);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: 4px 4px 0 var(--black);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-select:hover {
    background: var(--yellow-dark);
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--black);
}

.hero-select:focus {
    outline: none;
    background: #fff8e0;
    box-shadow: 4px 4px 0 var(--red-bg);
}

.hero-hint {
    margin-top: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #444;
    line-height: 1.45;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-panel.flash {
    animation: successFlash 0.4s ease;
}

/* Currency Inputs */
.currency-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    padding: 0 5px 10px;
    border-bottom: 1px solid var(--black);
    margin-bottom: 10px;
}

.table-header span {
    font-weight: 900;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--black);
}

.currency-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 5px;
    transition: background 0.2s ease;
    border-radius: 4px;
}

.currency-row:hover {
    background: rgba(0, 0, 0, 0.05);
}

.currency-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flag {
    font-size: 1.3rem;
}

.currency-code {
    font-weight: 900;
    font-size: 1rem;
    color: var(--black);
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 60px;
}

.kinder-code {
    font-size: 0.65rem;
    line-height: 1.2;
    letter-spacing: 0.5px;
    max-width: 130px;
}

.currency-name {
    display: none;
}

.currency-input {
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--black);
    text-align: right;
    width: 120px;
    padding: 5px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.currency-input:focus {
    border-bottom-color: var(--red-bg);
}

.currency-input::placeholder {
    color: #999;
}

.currency-input::-webkit-outer-spin-button,
.currency-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.currency-input[type=number] {
    -moz-appearance: textfield;
}

/* Kinder Bueno special row */
.kinder-row {
    background: rgba(247, 201, 72, 0.2);
    border-radius: 4px;
    margin-top: 5px;
}

.kinder-row:hover {
    background: rgba(247, 201, 72, 0.3);
}

/* Total divider */
.total-divider {
    height: 2px;
    background: var(--black);
    margin: 15px 0;
}

/* Lucky Button */
.lucky-button {
    width: 100%;
    margin-top: 20px;
    padding: 15px 20px;
    background: var(--yellow);
    border: 3px solid var(--black);
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Dela Gothic One', cursive;
    font-size: 1rem;
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 0 var(--black);
}

.lucky-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--black);
}

.lucky-button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--black);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-jp {
    display: none;
}

/* Footer */
.footer {
    margin-top: 20px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px dashed #999;
}

.update-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.update-icon {
    font-size: 0.9rem;
    animation: none;
}

.china-hint {
    margin-top: 10px;
    font-size: 0.65rem;
    color: #888;
    line-height: 1.35;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* Как ссылка «← Конвертер» на странице гида */
.footer-guide-cta {
    margin-top: 18px;
    margin-bottom: 2px;
    text-align: center;
}

.footer-guide-cta a {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--black);
    text-decoration: none;
    border-bottom: 2px solid var(--black);
    padding-bottom: 2px;
}

.footer-guide-cta a:hover {
    color: var(--red-bg);
    border-bottom-color: var(--red-bg);
}

/* Logo/Badge at bottom */
.logo-badge {
    margin-top: 15px;
    text-align: center;
}

.logo-text {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.5rem;
    color: var(--black);
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 2px;
}

/* Success Flash */
@keyframes successFlash {
    0% { background-color: transparent; }
    50% { background-color: rgba(247, 201, 72, 0.4); }
    100% { background-color: transparent; }
}

.currency-row.flash {
    animation: successFlash 0.4s ease;
}

/* Responsive */
@media (max-width: 420px) {
    body {
        padding: 15px;
        background-size: 30px 30px;
    }
    
    .converter-card {
        padding: 35px 20px 25px;
    }
    
    .title-main {
        font-size: 1.8rem;
    }
    
    .currency-input {
        width: 100px;
        font-size: 1rem;
    }
    
    .chopsticks {
        width: 160px;
    }
    
    .chopstick {
        width: 150px;
        height: 6px;
    }

    .hero-controls {
        flex-direction: column;
    }

    .hero-field {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Loading state */
.loading .currency-input,
.loading .hero-input,
.loading .hero-select {
    opacity: 0.55;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
}

::-webkit-scrollbar-thumb {
    background: var(--red-bg);
    border-radius: 4px;
}
