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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

html {
    overflow-x: clip; /* clip doesn't affect overflow-y, unlike hidden */
    scroll-behavior: smooth;
}

header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 2px;
}

header h1 span {
    color: #ffd700;
}

header h1 iconify-icon {
    vertical-align: -4px;
}

/* Easter Egg */
.easter-egg-trigger {
    position: relative;
    cursor: pointer;
}

.easter-egg-img {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-20px);
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border: 2px solid #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.easter-egg-trigger:hover .easter-egg-img {
    opacity: 1;
    transform: translateY(-50%) translateX(10px);
}

header > .lang-toggle {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

header > .header-links {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.reddit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid rgba(255, 99, 20, 0.5);
    border-radius: 20px;
    color: #ff6314;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}

.reddit-btn:hover {
    background: rgba(255, 99, 20, 0.15);
}

.lang-toggle {
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 20px;
    color: #ffd700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-toggle:hover {
    background: rgba(255, 215, 0, 0.3);
}

.bmc-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #FFDD00;
    border-radius: 20px;
    color: #000;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.bmc-btn:hover {
    background: #ffed4a;
    transform: translateY(-1px);
}

.bmc-btn svg {
    width: 16px;
    height: 16px;
}

.container {
    display: flex;
    gap: 20px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

.calc-section {
    flex: 2;
    transition: flex 0.3s ease;
}

.chat-section {
    flex: 1;
    min-width: 320px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.chat-section.collapsed {
    flex: 0;
    min-width: 48px;
    max-width: 48px;
}

@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }
    .chat-section {
        max-width: 100%;
        min-width: 100%;
        height: 400px;
    }
    .chat-section.collapsed {
        height: 48px;
        min-width: 100%;
    }
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 16px 16px 0 0;
}

/* Calculator Panel */
.calc-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.input-group input[type="number"] {
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1.1rem;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-group h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.radio-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-option {
    flex: 1;
    min-width: 100px;
}

.radio-option input {
    display: none;
}

.radio-option label {
    display: block;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.radio-option input:checked + label {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.25);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    color: #fff;
}

.radio-option label:hover {
    border-color: rgba(255, 215, 0, 0.5);
}

.card-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* Results */
.results {
    background: rgba(255, 215, 0, 0.1);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.results.collapsed {
    border-bottom-color: transparent;
}

/* Fade overlay for collapsed state - covers bottom portion */
.results.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(22, 33, 62, 0.8) 60%,
        rgba(22, 33, 62, 0.98) 100%
    );
    border-radius: 0 0 12px 12px;
    pointer-events: none;
}

/* Fade side borders - left */
.results.collapsed::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -1px;
    width: 1px;
    height: 35%;
    background: linear-gradient(
        to bottom,
        rgba(255, 215, 0, 0.2) 0%,
        transparent 100%
    );
    pointer-events: none;
}

/* Additional element for right border fade using box-shadow trick */
.results.collapsed .results-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -1px;
    width: 1px;
    height: 35%;
    background: linear-gradient(
        to bottom,
        rgba(255, 215, 0, 0.2) 0%,
        transparent 100%
    );
    pointer-events: none;
}

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

.results.collapsed .results-header {
    margin-bottom: 0;
}

.results.collapsed .calc-step:first-child {
    margin-top: 0;
}

.results.collapsed .calc-step:first-child .step-header {
    padding-top: 4px;
    padding-bottom: 4px;
}

.results-header h3 {
    font-size: 1rem;
    color: #ffd700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-header h3 .detail-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255, 215, 0, 0.6);
}

.fold-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    color: #ffd700;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.fold-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

.fold-btn svg {
    transition: transform 0.3s;
}

.results.collapsed .fold-btn svg {
    transform: rotate(0deg);
}

.results:not(.collapsed) .fold-btn svg {
    transform: rotate(180deg);
}

.results-content {
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
}

.results.collapsed .results-content {
    max-height: 130px;
    position: relative;
}

.results:not(.collapsed) .results-content {
    max-height: 2000px;
}

.results h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: #ffd700;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.result-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 10px;
}

.result-item .label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.result-item .value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffd700;
}

.result-item.full-width {
    grid-column: span 2;
}

.result-item.full-width.highlight {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.result-item .value.negative {
    color: #ff6b6b;
}

.result-item .value.positive {
    color: #51cf66;
}

/* Step-by-step calculation */
.calc-step {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.calc-step.final {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.step-number {
    width: 22px;
    height: 22px;
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.step-content {
    padding: 10px 14px;
}

.calc-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr auto;
    gap: 8px;
    padding: 6px 0;
    align-items: center;
    font-size: 0.8rem;
}

.calc-row.subtotal {
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    margin-top: 4px;
    padding-top: 10px;
}

.calc-row.total {
    border-top: 1px solid rgba(255, 215, 0, 0.3);
    margin-top: 8px;
    padding-top: 12px;
}

.calc-label {
    color: rgba(255, 255, 255, 0.7);
}

.calc-formula {
    color: rgba(255, 255, 255, 0.4);
    font-family: monospace;
    font-size: 0.7rem;
    text-align: right;
}

.multiplier-highlight {
    color: #ffd700;
    font-weight: 700;
    background: rgba(255, 215, 0, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
    cursor: help;
    position: relative;
    transition: all 0.2s ease;
}

.multiplier-highlight:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.calc-result {
    font-weight: 600;
    color: #fff;
    text-align: right;
    min-width: 70px;
}

.calc-result.negative {
    color: #ff6b6b;
}

.calc-result.positive {
    color: #51cf66;
}

.calc-result.highlight {
    color: #ffd700;
    font-size: 1.1rem;
}

.calc-row.total .calc-label {
    font-weight: 600;
    color: #ffd700;
}

/* Year summary */
.calc-step.year-summary {
    background: rgba(81, 207, 102, 0.05);
    border: 1px solid rgba(81, 207, 102, 0.2);
}

.calc-step.year-summary .step-number {
    background: rgba(81, 207, 102, 0.2);
    color: #51cf66;
}

.year-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.year-box {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
}

.year-box.year1 {
    background: linear-gradient(135deg, rgba(81, 207, 102, 0.15), rgba(81, 207, 102, 0.05));
    border: 1px solid rgba(81, 207, 102, 0.3);
}

.year-box.year2 {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.year-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.year-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.year-box.year1 .year-value {
    color: #51cf66;
}

.year-detail {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.result-breakdown {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    display: flex;
    gap: 24px;
}

.breakdown-item {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.75rem;
}

.breakdown-item .calc-label {
    color: rgba(255, 255, 255, 0.5);
}

.breakdown-item .calc-result {
    font-size: 0.8rem;
    min-width: auto;
}

/* Card comparison */
.comparison {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison h3 {
    font-size: 1rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

.comparison-switch-note {
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.7);
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

.comparison-content {
    overflow: hidden;
    transition: all 0.3s ease;
    margin-top: 16px;
}

.comparison.collapsed .comparison-content {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
}

.comparison:not(.collapsed) .comparison-content {
    max-height: 500px;
    opacity: 1;
}

.comparison.collapsed .fold-btn svg {
    transform: rotate(0deg);
}

.comparison:not(.collapsed) .fold-btn svg {
    transform: rotate(180deg);
}

/* Desktop: 4-column grid (label + 3 cards) */
.comparison-grid-wrapper {
    display: grid;
    grid-template-columns: 100px repeat(3, 1fr);
    gap: 8px;
}

.comp-header {
    text-align: center;
    font-weight: 600;
    padding: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.comp-header:first-child {
    /* Empty corner cell */
}

.comp-row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #ffd700;
    font-size: 0.8rem;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
}

.comp-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    position: relative;
}

.comp-card.card-blue {
    border-color: rgba(74, 144, 217, 0.4);
    background: rgba(74, 144, 217, 0.1);
}

.comp-card.card-obsidian {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(40, 40, 40, 0.4);
}

.comp-card.card-palladium {
    border-color: rgba(142, 142, 147, 0.4);
    background: rgba(142, 142, 147, 0.1);
}

.comp-card.best {
    border-color: #ffd700 !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.comp-card .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.comp-card.best .value {
    color: #ffd700;
}

.comp-card .value-label {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.comp-card .points-info {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.comp-card .signup-bonus-info {
    font-size: 0.65rem;
    color: rgba(81, 207, 102, 0.8);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.comp-card .best-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ffd700;
    color: #1a1a2e;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Old comparison grid (keep for backwards compatibility during transition) */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.comparison-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.comparison-card.card-blue {
    border-color: rgba(74, 144, 217, 0.4);
    background: rgba(74, 144, 217, 0.1);
}
.comparison-card.card-blue .card-value {
    color: #4A90D9;
}

.comparison-card.card-obsidian {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(40, 40, 40, 0.4);
}
.comparison-card.card-obsidian .card-value {
    color: #aaa;
}

.comparison-card.card-palladium {
    border-color: rgba(142, 142, 147, 0.4);
    background: rgba(142, 142, 147, 0.1);
}
.comparison-card.card-palladium .card-value {
    color: #8E8E93;
}

.comparison-card.best {
    border-color: #ffd700 !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.comparison-card.best .card-value {
    color: #ffd700 !important;
}

.comparison-card .card-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.comparison-card .card-value {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.comparison-card .card-detail {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.comparison-card .card-breakdown {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    font-family: monospace;
}

.comparison-card .card-value-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.comparison-card .card-first-year {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.comparison-card .card-first-year .first-year-label {
    color: rgba(255, 255, 255, 0.4);
}

.comparison-card .card-first-year .bonus-detail {
    font-size: 0.65rem;
    color: rgba(76, 175, 80, 0.7);
}

.comparison-card .card-first-year.best-first {
    color: #ffd700;
}

.comparison-card .card-first-year.best-first .bonus-detail {
    color: rgba(255, 215, 0, 0.7);
}

.best-badge {
    background: #ffd700;
    color: #1a1a2e;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 8px;
    display: inline-block;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-height: 800px;
}

.chat-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-reddit-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #ff6314;
    background: transparent;
    transition: all 0.2s;
}

.chat-reddit-link:hover {
    background: rgba(255, 99, 20, 0.15);
}

.toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.toggle-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

.toggle-btn svg {
    width: 18px;
    height: 18px;
    fill: #ffd700;
    transition: transform 0.3s;
}

.chat-section.collapsed .toggle-btn svg {
    transform: rotate(180deg);
}

.chat-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chat-section.collapsed .chat-content,
.chat-section.collapsed .chat-header-title span {
    display: none;
}

.chat-section.collapsed .chat-panel {
    height: 100%;
}

.chat-section.collapsed .chat-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 16px 8px;
    height: 100%;
    justify-content: flex-start;
    gap: 16px;
}

.chat-section.collapsed .chat-header-actions {
    writing-mode: horizontal-tb;
    flex-direction: column;
    gap: 8px;
}

.chat-section.collapsed .toggle-btn {
    writing-mode: horizontal-tb;
}

.chat-section.collapsed .chat-reddit-link {
    writing-mode: horizontal-tb;
}

.api-key-section {
    padding: 10px 12px;
    background: rgba(255, 215, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.api-key-section input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.85rem;
}

.api-key-section input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 90%;
    line-height: 1.5;
    font-size: 0.85rem;
}

.message.user {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a2e;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: rgba(255, 255, 255, 0.1);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.assistant strong {
    color: #ffd700;
    font-weight: 600;
}

.message.assistant code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

.message.assistant ul, .message.assistant ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message.assistant li {
    margin: 4px 0;
}

.message.assistant p {
    margin: 6px 0;
}

.message.assistant p:first-child {
    margin-top: 0;
}

.message.assistant p:last-child {
    margin-bottom: 0;
}

.message.system {
    background: rgba(255, 100, 100, 0.2);
    align-self: center;
    font-size: 0.8rem;
    text-align: center;
}

.chat-input-container {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.85rem;
}

.chat-input-container button {
    padding: 10px 16px;
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 0.85rem;
}

.chat-input-container button:hover {
    transform: translateY(-1px);
}

.chat-input-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-input-container button.loading {
    background: linear-gradient(135deg, #666 0%, #555 100%);
    color: #999;
    cursor: not-allowed;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 16px 12px;
    color: rgba(255, 255, 255, 0.6);
}

.welcome-message h2 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 1rem;
}

.welcome-message p {
    font-size: 0.8rem;
    line-height: 1.5;
}

.quick-questions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-question {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    text-align: left;
    color: #fff;
}

.quick-question:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
}

/* 2D Input Selector */
.input-2d-container {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    position: sticky;
    top: 10px;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.input-2d-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.input-2d-header h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.input-2d-values {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
}

.input-2d-values span {
    color: #ffd700;
    font-weight: 600;
}

.input-2d-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}

.input-2d-y-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.input-2d-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-2d-area {
    position: relative;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(255, 215, 0, 0.15) 100%);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
    overflow: hidden;
}

.input-2d-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 33.33% 20%;
}

.input-2d-point {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.4);
    cursor: grab;
    z-index: 10;
    transition: transform 0.1s, box-shadow 0.1s;
}

.input-2d-point:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.6);
}

.input-2d-crosshair-h,
.input-2d-crosshair-v {
    position: absolute;
    background: rgba(255, 215, 0, 0.3);
    pointer-events: none;
}

.input-2d-crosshair-h {
    left: 0;
    right: 0;
    height: 1px;
}

.input-2d-crosshair-v {
    top: 0;
    bottom: 0;
    width: 1px;
}

.input-2d-x-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.input-2d-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 2px;
}

.input-2d-y-scale {
    position: absolute;
    left: -42px;
    top: -4px;
    bottom: -4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
    width: 40px;
}

.input-2d-scale > span:first-child,
.input-2d-scale > span:last-child,
.input-2d-y-scale > span:first-child,
.input-2d-y-scale > span:last-child {
    color: rgba(255, 255, 255, 0.8) !important;
}

.scale-emoji {
    font-size: 1.2rem;
    vertical-align: middle;
    display: inline-block;
    opacity: 1 !important;
    filter: none !important;
}

.input-2d-area-wrapper {
    position: relative;
    margin-left: 36px;
}

/* 2D + Manual Input Layout */
.input-2d-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.input-2d-left {
    width: 240px;
    flex-shrink: 0;
}

.input-2d-right {
    width: 120px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: flex-start;
    overflow: visible;
    flex-shrink: 0;
}

.input-2d-options {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.input-2d-cards,
.input-2d-reward,
.input-2d-hotel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.input-2d-cards h4,
.input-2d-reward h4,
.input-2d-hotel h4 {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    margin: 0;
}

/* Obsidian Multiplier Slider */
.obsidian-mult-section {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
    margin: 0;
    background: rgba(80, 80, 80, 0.4);
    border: 1px solid #888;
    border-radius: 10px;
    max-width: 130px;
}

.obsidian-mult-section.visible {
    display: flex;
}

.obsidian-mult-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.obsidian-mult-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.obsidian-mult-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #bbb;
}

.obsidian-mult-section input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
}

.obsidian-mult-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #bbb;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.obsidian-mult-section input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #ddd;
}

.obsidian-mult-section input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #bbb;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Bilt Cash Value Slider */
.bilt-cash-value-section {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
    margin-top: 8px;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    max-width: 130px;
}

.bilt-cash-value-section.visible {
    display: flex;
}

.bilt-cash-value-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bilt-cash-value-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.bilt-cash-value-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffd700;
}

.bilt-cash-value-section input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    cursor: pointer;
}

.bilt-cash-value-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.bilt-cash-value-section input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #ffed4a;
}

.bilt-cash-value-section input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.hotel-options .radio-option label {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.card-options-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-options-vertical .radio-option {
    min-width: auto;
    flex: none;
}

.card-options-vertical .radio-option label {
    padding: 8px 12px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.card-fee {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.card-options-vertical .radio-option input:checked + label .card-fee {
    color: rgba(255, 255, 255, 0.8);
}

/* Card-specific colors */
.card-blue {
    --card-color: #4A90D9;
    --card-color-rgb: 74, 144, 217;
}

.card-obsidian {
    --card-color: #1a1a1a;
    --card-color-rgb: 26, 26, 26;
}

.card-palladium {
    --card-color: #8E8E93;
    --card-color-rgb: 142, 142, 147;
}

/* Card selection styling */
#cardBlue + label {
    border-color: rgba(74, 144, 217, 0.3);
}
#cardBlue:checked + label {
    border-color: #4A90D9;
    background: rgba(74, 144, 217, 0.3);
    box-shadow: 0 0 10px rgba(74, 144, 217, 0.4);
}
#cardBlue + label:hover {
    border-color: rgba(74, 144, 217, 0.6);
}

#cardObsidian + label {
    border-color: rgba(255, 255, 255, 0.2);
}
#cardObsidian:checked + label {
    border-color: #888;
    background: rgba(80, 80, 80, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}
#cardObsidian + label:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

#cardPalladium + label {
    border-color: rgba(142, 142, 147, 0.3);
}
#cardPalladium:checked + label {
    border-color: #aaa;
    background: rgba(142, 142, 147, 0.3);
    box-shadow: 0 0 10px rgba(142, 142, 147, 0.4);
}
#cardPalladium + label:hover {
    border-color: rgba(142, 142, 147, 0.6);
}

.manual-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.manual-input-group .tooltip {
    left: auto;
    right: 0;
    transform: none;
}

.manual-input-group .tooltip::after {
    left: auto;
    right: 10px;
    transform: none;
}

.manual-input-group label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.manual-input-group input {
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #ffd700;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
}

.manual-input-group input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

@media (max-width: 768px) {
    /* Mobile: Stack option groups vertically */
    .comparison-grid-wrapper {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .comp-header {
        display: none;
    }

    .comp-row-label {
        display: none;
    }

    .comp-option-group {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 12px;
        padding: 12px;
    }

    .comp-option-group .option-title {
        font-size: 0.85rem;
        color: #ffd700;
        margin-bottom: 10px;
        text-align: center;
        font-weight: 600;
    }

    .comp-option-group .cards-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .comp-card {
        padding: 10px 6px;
    }

    .comp-card .card-name {
        font-size: 0.7rem;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .comp-card .value {
        font-size: 0.95rem;
    }

    .comp-card .value-label {
        font-size: 0.5rem;
    }

    .comp-card .points-info {
        font-size: 0.6rem;
    }

    .comp-card .signup-bonus-info {
        font-size: 0.6rem;
        margin-top: 4px;
        padding-top: 4px;
    }

    .comp-card .best-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
        top: -6px;
        right: -6px;
    }
}

@media (max-width: 600px) {
    .input-2d-row {
        flex-direction: column;
    }
    .input-2d-left {
        width: 100%;
        flex-shrink: 1;
    }
    .input-2d-right {
        width: 100%;
        flex-direction: row;
        flex-shrink: 1;
    }
    .manual-input-group {
        flex: 1;
    }
    .input-2d-options {
        flex-direction: column;
        width: 100%;
    }

    /* Comparison grid - Keep 3 columns at 600px */
    .comparison-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .comparison-card {
        padding: 10px 8px;
    }

    .comparison-card .card-name {
        font-size: 0.75rem;
    }

    .comparison-card .card-value {
        font-size: 1rem;
    }

    /* Year comparison still 2 columns at this size */
    .year-comparison {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tooltip styles */
.label-with-help {
    display: flex;
    align-items: center;
    gap: 6px;
}

.help-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.3);
    border: none;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.help-btn:hover {
    background: rgba(255, 215, 0, 0.5);
}

.help-btn.small {
    width: 14px;
    height: 14px;
    font-size: 9px;
}

/* Compact radio options */
.card-options-vertical.compact .radio-option label {
    padding: 6px 10px;
    font-size: 0.75rem;
}

.input-2d-reward h4.label-with-help,
.input-2d-hotel h4.label-with-help {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.5;
    width: 240px;
    text-align: left;
    font-weight: 400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

.help-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip strong {
    color: #ffd700;
}

.breakdown-item .help-btn {
    width: 14px;
    height: 14px;
    font-size: 9px;
}

.breakdown-item .tooltip {
    width: 220px;
}

/* Footer */
.site-footer {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    text-align: center;
    margin-top: 30px;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-content a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.footer-content a:hover {
    color: #ffd700;
}

.footer-content svg {
    vertical-align: middle;
}

.footer-divider {
    color: rgba(255, 255, 255, 0.3);
}

/* ===========================================
   MOBILE RESPONSIVE STYLES
   =========================================== */

/* Phase 1: Touch Targets - Expand touch area while keeping visual size */
.help-btn {
    position: relative;
}

.help-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    /* Invisible but tappable */
}

/* 480px Breakpoint - Small phones */
@media (max-width: 480px) {
    /* Header Mobile Layout */
    header {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    header h1 {
        font-size: clamp(1.1rem, 4vw, 1.3rem);
        letter-spacing: 1px;
        order: 1;
        width: 100%;
        text-align: center;
    }

    header > .lang-toggle {
        position: static;
        transform: none;
        order: 2;
    }

    header > .header-links {
        position: static;
        transform: none;
        order: 3;
    }

    .lang-toggle {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Buy Me Coffee - Icon only on small screens */
    .bmc-btn span {
        display: none;
    }

    .bmc-btn {
        padding: 8px;
    }

    .reddit-btn {
        padding: 8px;
    }

    .reddit-btn span {
        display: none;
    }

    /* Easter egg - hide on mobile to prevent overflow */
    .easter-egg-img {
        display: none;
    }

    /* Container - prevent overflow */
    .container {
        padding: 12px;
        width: 100%;
        max-width: 100vw;
    }

    /* Chat section - remove min-width */
    .chat-section {
        min-width: 0;
        width: 100%;
    }

    /* Panel - prevent overflow */
    .panel {
        max-width: 100%;
        overflow: hidden;
    }

    /* Calculator content */
    .calc-content {
        padding: 12px;
        gap: 16px;
        max-width: 100%;
    }

    /* Comparison grid - Keep 3 columns but compact */
    .comparison-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    /* Fixed comparison at bottom on mobile */
    .comparison {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 8px 12px;
        background: rgba(26, 26, 46, 0.98);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 215, 0, 0.3);
        z-index: 100;
        margin: 0;
        border-radius: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }

    /* Hide comparison header and switch note on mobile (save space) */
    .comparison-header {
        display: none;
    }

    .comparison-switch-note {
        display: none;
    }

    /* Remove collapsed state on mobile - always visible */
    .comparison.collapsed .comparison-content {
        display: flex !important;
        flex-direction: column !important;
        max-height: none !important;
    }

    /* Add bottom padding to body to prevent content from being hidden behind fixed footer */
    body {
        padding-bottom: 200px;
    }

    /* Mobile comparison grid */
    .comparison-grid-wrapper {
        gap: 8px;
    }

    .comp-option-group {
        padding: 8px;
    }

    .comp-option-group .option-title {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .comp-option-group .cards-row {
        gap: 6px;
    }

    .comp-card {
        padding: 6px 4px;
        border-radius: 6px;
    }

    .comp-card .card-name {
        font-size: 0.6rem;
    }

    .comp-card .value {
        font-size: 0.85rem;
    }

    .comp-card .value-label {
        font-size: 0.45rem;
    }

    .comp-card .points-info {
        display: none;
    }

    .comp-card .signup-bonus-info {
        font-size: 0.55rem;
        margin-top: 4px;
        padding-top: 4px;
    }

    .comp-card .best-badge {
        font-size: 0.5rem;
        padding: 1px 3px;
        top: -4px;
        right: -4px;
    }

    .comparison-card {
        padding: 8px 6px;
        border-radius: 8px;
    }

    .comparison-card .card-name {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }

    .comparison-card .card-value {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    .comparison-card .card-value-label {
        font-size: 0.5rem;
    }

    .comparison-card .card-detail {
        font-size: 0.6rem;
        display: none; /* Hide on mobile for compactness */
    }

    .comparison-card .card-breakdown {
        display: none; /* Hide on mobile */
    }

    .comparison-card .card-first-year {
        margin-top: 6px;
        padding-top: 6px;
        font-size: 0.6rem;
    }

    .comparison-card .card-first-year .bonus-detail {
        display: none; /* Hide bonus detail on mobile */
    }

    .best-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
        margin-top: 4px;
    }

    /* Year comparison - Stack */
    .year-comparison {
        grid-template-columns: 1fr;
    }

    /* 2D Input - Remove sticky, adjust layout */
    .input-2d-container {
        position: relative;
        top: 0;
        padding: 12px;
        max-width: 100%;
    }

    .input-2d-options {
        flex-direction: column;
        gap: 12px;
    }

    .input-2d-row {
        flex-direction: column;
        width: 100%;
    }

    .input-2d-left {
        width: 100%;
        max-width: 100%;
        flex-shrink: 1;
    }

    .input-2d-right {
        width: 100%;
        flex-shrink: 1;
        flex-direction: column;
    }

    /* 2D area wrapper - fix overflow */
    .input-2d-area-wrapper {
        margin-left: 30px;
        max-width: calc(100% - 30px);
    }

    /* Manual inputs stack vertically */
    .manual-input-group {
        width: 100%;
    }

    /* Obsidian and Bilt Cash sliders - full width */
    .obsidian-mult-section,
    .bilt-cash-value-section {
        max-width: 100%;
    }

    /* Result grid - single column on small */
    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-item.full-width {
        grid-column: span 1;
    }

    /* Tooltips - Responsive width */
    .tooltip {
        width: calc(100vw - 40px);
        max-width: 280px;
        left: auto;
        right: -10px;
        transform: none;
    }

    .tooltip::after {
        left: auto;
        right: 20px;
        transform: none;
    }

    /* Result breakdown - stack on mobile */
    .result-breakdown {
        flex-direction: column;
        gap: 12px;
    }

    /* Calc row - responsive grid */
    .calc-row {
        grid-template-columns: 1fr auto;
        gap: 4px;
    }

    .calc-formula {
        display: none;
    }

    /* Panel header */
    .panel-header {
        padding: 12px 16px;
        font-size: 1rem;
    }

    /* Radio options - ensure proper touch size */
    .radio-option label {
        padding: 14px 12px;
        min-height: 44px;
    }

    /* Card options */
    .card-options-vertical .radio-option label {
        padding: 12px;
        min-height: 44px;
    }

    /* Chat section height adjustment */
    .chat-section {
        height: 350px;
    }

    /* Comparison card padding */
    .comparison-card {
        padding: 14px;
    }

    /* Fold button - ensure touch target */
    .fold-btn {
        padding: 8px 12px;
        min-height: 36px;
    }
}

/* 375px Breakpoint - Extra small phones (iPhone SE, etc.) */
@media (max-width: 375px) {
    /* Container - tighter padding */
    .container {
        padding: 10px;
    }

    /* Calculator content */
    .calc-content {
        padding: 10px;
        gap: 14px;
    }

    /* Header */
    header {
        padding: 10px;
    }

    header h1 {
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }

    /* Results section */
    .results {
        padding: 14px;
    }

    /* Comparison section */
    .comparison {
        padding: 14px;
    }

    .comparison h3 {
        font-size: 0.9rem;
    }

    /* 2D Input area - slightly shorter */
    .input-2d-area {
        height: 100px;
    }

    .input-2d-container {
        padding: 10px;
    }

    /* Font size adjustments */
    .result-item .value {
        font-size: 1.2rem;
    }

    .year-value {
        font-size: 1.3rem;
    }

    .comparison-card .card-value {
        font-size: 1.1rem;
    }

    /* Tooltip - even more compact */
    .tooltip {
        width: calc(100vw - 30px);
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    /* Input fields */
    .input-group input[type="number"],
    .manual-input-group input {
        padding: 10px;
        font-size: 1rem;
    }

    /* Chat panel */
    .chat-panel {
        height: calc(100vh - 160px);
    }

    .chat-messages {
        padding: 10px;
    }

    .message {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    /* Step content padding */
    .step-content {
        padding: 8px 10px;
    }

    .step-header {
        padding: 8px 10px;
    }

    /* Quick questions */
    .quick-question {
        padding: 10px;
        font-size: 0.7rem;
    }

    /* Site footer */
    .site-footer {
        padding: 12px 15px;
    }

    .footer-content {
        font-size: 0.75rem;
        gap: 8px;
    }
}

/* ============================================
   COMMUNITY QUOTE SECTION
   ============================================ */
.community-quote {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 99, 20, 0.05);
    border-left: 3px solid #ff6314;
    border-radius: 0 8px 8px 0;
    text-align: center;
}

.community-quote blockquote {
    font-style: italic;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0;
}

.community-quote .quote-credit {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #ff6314;
    text-decoration: none;
}

.community-quote .quote-credit:hover {
    text-decoration: underline;
}

.community-quote .calculator-list-link {
    display: block;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffd700;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    transition: all 0.2s;
}

.community-quote .calculator-list-link:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
}

/* ============================================
   DECISION FLOWCHART SECTION
   ============================================ */
.decision-flowchart {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.decision-flowchart h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.decision-flowchart img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.decision-flowchart img:hover {
    opacity: 0.9;
}

.flowchart-credit {
    font-size: 0.7rem;
    font-weight: 400;
    color: #ff6314;
    text-decoration: none;
}

.flowchart-credit:hover {
    text-decoration: underline;
}

/* ============================================
   OTHER CALCULATORS SECTION
   ============================================ */
.other-calculators {
    margin-top: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.other-calculators h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    margin-bottom: 12px;
    text-align: center;
}

.calculators-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.calculators-grid a {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.calculators-grid a:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    color: #ffd700;
}

.calculators-grid .calc-domain {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
}

.calculators-grid a:hover .calc-domain {
    color: rgba(255, 215, 0, 0.6);
}

.calculators-grid .external-icon {
    font-size: 0.7rem;
    opacity: 0.5;
    margin-left: 2px;
}

.calculators-grid a:hover .external-icon {
    opacity: 1;
}

@media (max-width: 480px) {
    .other-calculators {
        margin-top: 16px;
        padding: 12px;
    }

    .other-calculators h3 {
        font-size: 0.8rem;
    }

    .calculators-grid a {
        padding: 5px 10px;
        font-size: 0.7rem;
    }

    .calculators-grid .calc-domain {
        font-size: 0.6rem;
    }
}
