:root {
    --bg-dark: #0B0E14;
    --panel-bg: #141923;
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-hover: #1D2433;
    --text-primary: #F0F4F8;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --ficsit-orange: #FA9549;
    --ficsit-glow: rgba(250, 149, 73, 0.35);
    --accent-blue: #38BDF8;
    --accent-purple: #A855F7;
    --accent-green: #22C55E;
    --accent-red: #EF4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-main: 0 10px 30px -10px rgba(0,0,0,0.5);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(20, 25, 35, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 24px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

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

.ficsit-badge {
    background: var(--ficsit-orange);
    color: #000;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.accent-text {
    color: var(--ficsit-orange);
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    gap: 6px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--ficsit-orange);
    background: rgba(250, 149, 73, 0.12);
}

.nav-icon {
    width: 18px;
    height: 18px;
}

/* World Ratios Button */
.world-ratios-btn {
    background: rgba(20, 25, 35, 0.85);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.world-ratios-btn:hover {
    border-color: rgba(250, 149, 73, 0.5);
    color: var(--text-primary);
}

.world-ratios-btn.custom {
    border-color: var(--ficsit-orange);
    color: var(--ficsit-orange);
    background: rgba(250, 149, 73, 0.14);
    box-shadow: 0 0 14px var(--ficsit-glow);
}

.ratio-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.2s ease;
}

.world-ratios-btn.custom .ratio-indicator-dot {
    background: var(--ficsit-orange);
    box-shadow: 0 0 8px var(--ficsit-orange);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Bar in Item Reference View */
.item-search-bar-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 20px;
}

.item-search-input-box {
    flex: 1;
    position: relative;
}

.item-search-input-box input {
    width: 100%;
    background: rgba(11, 14, 20, 0.85);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 12px 42px 12px 42px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.item-search-input-box input:focus {
    outline: none;
    border-color: var(--ficsit-orange);
    box-shadow: 0 0 0 3px var(--ficsit-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(250, 149, 73, 0.15);
    color: var(--ficsit-orange);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.results-count-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 0 4px;
}

.filter-controls {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
    min-width: 260px;
    justify-content: center;
}

.filter-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.filter-btn.active {
    background: var(--ficsit-orange);
    color: #000;
}

/* Star Buttons Styling */
.star-btn {
    background: transparent;
    border: none;
    font-size: 1.35rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease, filter 0.15s ease;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.star-btn:hover {
    transform: scale(1.25);
    color: #F59E0B;
}

.star-btn.active {
    color: #F59E0B;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.7));
}

.recipe-star-btn {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
    padding: 2px 4px;
    line-height: 1;
    user-select: none;
}

.recipe-star-btn:hover {
    transform: scale(1.2);
    color: #F59E0B;
}

.recipe-star-btn.active {
    color: #F59E0B;
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.6));
}

/* Satisfactory In-Game Metallic Silver Slot Background */
.game-icon-bg {
    background: linear-gradient(135deg, #E6EBF0 0%, #D0D8E0 50%, #BDC6D0 100%) !important;
    border: 1px solid #94A3B8 !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.9), 0 3px 6px rgba(0, 0, 0, 0.25) !important;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    flex-shrink: 0;
    overflow: hidden;
}

.game-icon-bg img {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

.game-icon-bg-lg {
    width: 54px;
    height: 54px;
}

.game-icon-bg-md {
    width: 44px;
    height: 44px;
}

.game-icon-bg-sm {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    padding: 2px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.game-icon-bg-sm img {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
}

/* Item Reference Accordion Layout */
.items-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-reference-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.item-reference-card:hover {
    border-color: rgba(250, 149, 73, 0.4);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.4);
}

.item-reference-card.open {
    border-color: var(--ficsit-orange);
    box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.5);
}

/* Accordion Header */
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--panel-bg);
    transition: background 0.15s ease;
}

.accordion-header:hover {
    background: var(--panel-hover);
}

.accordion-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-header-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-header-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.accordion-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.25s ease, color 0.25s ease;
    flex-shrink: 0;
}

.item-reference-card.open .accordion-chevron, .method-accordion-card.open .accordion-chevron {
    transform: rotate(180deg);
    color: var(--ficsit-orange);
}

/* Accordion Body */
.accordion-body {
    display: none;
    padding: 0 20px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(11, 14, 20, 0.4);
}

.item-reference-card.open .accordion-body {
    display: block;
}

.card-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-tag.accent {
    color: var(--ficsit-orange);
    border-color: rgba(250, 149, 73, 0.3);
}

.stat-tag.alt {
    color: var(--accent-purple);
    border-color: rgba(168, 85, 247, 0.3);
}

/* Two-Column Recipe Layout */
.recipes-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 769px) {
    .recipe-col.mobile-hidden {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .recipes-two-col {
        grid-template-columns: 1fr;
    }
}

.recipe-col {
    background: rgba(11, 14, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recipe-col-title {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.recipe-col-title.producing {
    color: var(--ficsit-orange);
}

.recipe-col-title.using {
    color: var(--accent-blue);
}

.recipe-count-badge {
    font-size: 0.74rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
}

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recipe-entry {
    background: rgba(20, 25, 35, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.recipe-entry:hover {
    background: var(--panel-hover);
    border-color: rgba(250, 149, 73, 0.4);
}

.recipe-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.recipe-name {
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rate-badge-sec-main {
    font-weight: 800;
    font-size: 0.82rem;
    color: var(--ficsit-orange);
    font-family: var(--font-heading);
    background: rgba(250, 149, 73, 0.12);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.recipe-tag {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.recipe-tag.alt {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.recipe-tag.std {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.recipe-machine-info {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* Ingredients & Products Badges */
.ingredients-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.ingredient-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px 3px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ingredient-badge:hover {
    background: rgba(250, 149, 73, 0.15);
    border-color: var(--ficsit-orange);
}

.ingredient-badge img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.ingredient-qty {
    font-weight: 700;
    color: var(--ficsit-orange);
}

.rate-badge-sec {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 0.74rem;
    background: rgba(56, 189, 248, 0.12);
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 2px;
}

/* Unlocks Section */
.unlocks-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.unlocks-section-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 10px;
}

.unlocks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 768px) {
    .unlocks-grid {
        grid-template-columns: 1fr;
    }
}

.unlock-card {
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.unlock-card:hover {
    background: rgba(168, 85, 247, 0.16);
    border-color: var(--accent-purple);
}

.unlock-category-tag {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-purple);
    letter-spacing: 0.04em;
}

.unlock-title {
    font-weight: 700;
    font-size: 0.84rem;
}

.unlock-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

/* Multi-Method Calculator Accordions */
.methods-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
}

.method-accordion-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.method-accordion-card:hover {
    border-color: rgba(250, 149, 73, 0.4);
}

.method-accordion-card.open {
    border-color: var(--ficsit-orange);
    box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.5);
}

.method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--panel-bg);
    transition: background 0.15s ease;
}

.method-header:hover {
    background: var(--panel-hover);
}

.method-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 340px;
    flex-shrink: 0;
}

.method-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.method-badge.std {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.method-badge.alt {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.method-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.method-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.method-raw-summary-wrap {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    max-width: 600px;
    padding-bottom: 2px;
}

.method-raw-summary-wrap::-webkit-scrollbar {
    height: 3px;
}

.method-raw-summary-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.method-raw-summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 7px 2px 3px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.power-summary-badge {
    background: rgba(250, 149, 73, 0.15);
    color: var(--ficsit-orange);
    border: 1px solid rgba(250, 149, 73, 0.3);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    white-space: nowrap;
}

.method-body {
    display: none !important;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(11, 14, 20, 0.5);
}

.method-accordion-card.open .method-body {
    display: block !important;
}

.method-grid-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .method-grid-layout {
        grid-template-columns: 1fr;
    }
}

.raw-materials-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.method-raw-card {
    background: rgba(20, 25, 35, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.raw-card-name {
    font-weight: 700;
    font-size: 0.88rem;
}

.raw-card-rate {
    font-size: 0.8rem;
    color: var(--ficsit-orange);
    font-weight: 700;
}

/* Construction Summary Box */
.construction-summary-box {
    margin-top: 16px;
    background: rgba(11, 14, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.construction-summary-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ficsit-orange);
    margin-bottom: 10px;
}

.construction-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.construction-bldg-card {
    background: rgba(20, 25, 35, 0.85);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.15s ease;
}

.construction-bldg-card:hover {
    border-color: var(--ficsit-orange);
}

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

.construction-bldg-text {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.construction-bldg-text strong {
    color: var(--ficsit-orange);
    font-weight: 800;
    font-size: 1rem;
}

.construction-mats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.construction-mat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 10px 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.construction-mat-badge:hover {
    background: rgba(250, 149, 73, 0.15);
    border-color: var(--ficsit-orange);
}

.construction-mat-badge strong {
    color: var(--ficsit-orange);
    font-weight: 700;
}

/* Vertical Progressive Flow Diagram */
.vertical-flow-diagram {
    background: rgba(11, 14, 20, 0.7);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.flow-diagram-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ficsit-orange);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flow-tier-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.flow-tier-header {
    margin-bottom: 2px;
}

.flow-tier-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.05em;
}

.flow-tier-nodes-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    width: 100%;
}

.flow-node {
    background: rgba(20, 25, 35, 0.9);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.flow-node:hover {
    border-color: var(--ficsit-orange);
    transform: translateY(-2px);
}

.flow-node.raw-node {
    border-left: 4px solid var(--accent-green);
}

.flow-node.bldg-node {
    border-left: 4px solid var(--ficsit-orange);
}

.flow-node-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.flow-node-title, .flow-node-machine {
    font-weight: 700;
    font-size: 0.9rem;
}

.capacity-tag {
    font-size: 0.76rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-left: 4px;
}

.flow-node-recipe {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.flow-node-rate {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ficsit-orange);
}

.flow-node-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
    display: inline-block;
    width: fit-content;
}

.flow-node-tag.raw {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.flow-node-tag.power {
    background: rgba(250, 149, 73, 0.15);
    color: var(--ficsit-orange);
}

.flow-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 4px 0;
}

.flow-arrow-line {
    width: 2px;
    height: 14px;
    background: var(--ficsit-orange);
    opacity: 0.7;
}

.flow-arrow-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cards Grid for Buildings */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.card-item {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card-item:hover {
    transform: translateY(-3px);
    border-color: var(--ficsit-orange);
}

.card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-info {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.card-category {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Calculator View */
.calculator-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.shadow-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.calc-centered-header {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    color: var(--ficsit-orange);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.custom-item-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(11, 14, 20, 0.85);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 6px 12px 6px 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-item-picker:focus-within {
    border-color: var(--ficsit-orange);
    box-shadow: 0 0 0 3px var(--ficsit-glow);
}

.item-search-input-field {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    padding: 4px 0;
    width: 100%;
}

.item-suggestions-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #141923;
    border: 1px solid var(--ficsit-orange);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    max-height: 280px;
    overflow-y: auto;
    z-index: 300;
}

.item-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.item-suggestion-item:last-child {
    border-bottom: none;
}

.item-suggestion-item:hover {
    background: rgba(250, 149, 73, 0.18);
}

.item-suggestion-name {
    font-weight: 700;
    font-size: 0.94rem;
    flex: 1;
}

.item-suggestion-form {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: capitalize;
}

.item-suggestion-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Remove number input spinners / increment scrollbars */
.no-spinner-input::-webkit-inner-spin-button, 
.no-spinner-input::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

.no-spinner-input, input[type=number] {
    -moz-appearance: textfield;
}

.calc-form-centered {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.calc-item-group {
    flex: 2;
    min-width: 320px;
}

.calc-qty-group {
    flex: 1;
    min-width: 160px;
}

.calc-btn-group {
    flex: 1;
    min-width: 160px;
}

.hidden-label {
    visibility: hidden;
}

/* Equal Height (50px) for all 3 form controls */
.custom-item-picker,
.calc-control-input,
.calc-control-btn {
    height: 50px !important;
    box-sizing: border-box !important;
}

.calc-control-input {
    width: 100%;
    padding: 0 14px !important;
    font-size: 1rem !important;
    background: rgba(11, 14, 20, 0.85);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.calc-control-input:focus {
    outline: none;
    border-color: var(--ficsit-orange);
    box-shadow: 0 0 0 3px var(--ficsit-glow);
}

.calc-control-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.95rem !important;
    font-weight: 700;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.92rem;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--ficsit-orange);
    color: #000;
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 10;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

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

/* World Settings Form Styling */
.dialog-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.world-settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.world-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(11, 14, 20, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.setting-info {
    flex: 1;
}

.setting-info label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.setting-input-wrap {
    width: 220px;
    height: 44px;
    display: flex;
    align-items: center;
    background: rgba(11, 14, 20, 0.9);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 0 12px;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.setting-input-wrap:focus-within {
    border-color: var(--ficsit-orange);
    box-shadow: 0 0 0 3px var(--ficsit-glow);
}

.setting-control-field {
    flex: 1;
    width: 100%;
    height: 100%;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    outline: none;
    cursor: pointer;
}

.setting-control-field option {
    background: var(--panel-bg);
    color: var(--text-primary);
    padding: 8px;
}

.unit-badge {
    font-weight: 800;
    color: var(--ficsit-orange);
    font-size: 0.88rem;
    padding-left: 6px;
    user-select: none;
    flex-shrink: 0;
}

.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hidden {
    display: none !important;
}

/* Touch target optimizations */
.star-btn {
    min-width: 44px;
    min-height: 44px;
}

.recipe-star-btn {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(14, 18, 26, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--panel-border);
    z-index: 200;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.bottom-nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 48px;
    user-select: none;
}

.bottom-nav-btn.active {
    color: var(--ficsit-orange);
    background: rgba(250, 149, 73, 0.12);
}

.bottom-nav-btn .nav-icon {
    width: 20px;
    height: 20px;
}

/* Mobile Recipe Segmented Control */
.recipe-segmented-control {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
    margin-top: 14px;
    margin-bottom: 12px;
}

.recipe-seg-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.recipe-seg-btn.active {
    background: var(--ficsit-orange);
    color: #000;
    box-shadow: 0 2px 8px rgba(250, 149, 73, 0.3);
}

.recipe-seg-btn .seg-count {
    font-size: 0.74rem;
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 6px;
    border-radius: 10px;
}

.recipe-seg-btn.active .seg-count {
    background: rgba(0, 0, 0, 0.25);
}

/* Mobile Responsive Breakpoints */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .app-header {
        padding: 10px 16px;
    }

    .header-container {
        gap: 10px;
    }

    .nav-tabs {
        display: none;
    }

    .logo-title {
        font-size: 1.1rem;
    }

    .ficsit-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    .world-ratios-btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .main-content {
        padding: 14px 12px;
    }

    .shadow-panel {
        padding: 16px;
    }

    /* Item Search & Filters */
    .item-search-bar-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 14px;
    }

    .search-shortcut {
        display: none;
    }

    .filter-controls {
        width: 100%;
        min-width: 0;
        padding: 4px;
        justify-content: center;
    }

    .filter-controls::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex: 1;
        padding: 8px 14px;
        font-size: 0.84rem;
        text-align: center;
        justify-content: center;
    }

    /* Accordion Item Cards on Mobile */
    .accordion-header {
        padding: 12px 14px;
        gap: 12px;
    }

    .item-header-title {
        font-size: 1rem;
        white-space: normal;
        word-break: break-word;
        text-overflow: clip;
    }

    .item-header-desc {
        display: none !important;
    }

    .card-stats {
        margin-top: 2px;
        gap: 6px;
    }

    .stat-tag {
        font-size: 0.72rem;
        padding: 2px 6px;
    }

    .stat-tag.mobile-hidden-stat {
        display: none !important;
    }

    .accordion-body {
        padding: 0 14px 14px 14px;
    }

    /* Recipes Segmented Control */
    .recipe-segmented-control {
        display: grid;
    }

    .recipes-two-col {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 8px;
    }

    .recipe-col.mobile-hidden {
        display: none !important;
    }

    /* Calculator View Stacking */
    .calc-form-centered {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .calc-item-group,
    .calc-qty-group,
    .calc-btn-group {
        width: 100%;
        min-width: 0;
    }

    .hidden-label {
        display: none;
    }

    /* Method Header in Calculator */
    .method-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }

    .method-header-left {
        min-width: 0 !important;
        flex-shrink: 1;
        justify-content: space-between;
        width: 100%;
    }

    .method-header-right {
        justify-content: space-between;
        width: 100%;
    }

    .method-raw-summary-wrap {
        max-width: 100%;
    }

    /* Method Body Stacking */
    .method-grid-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .vertical-flow-diagram {
        padding: 14px 10px;
    }

    .flow-node {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    /* Buildings Grid */
    .cards-grid {
        grid-template-columns: 1fr;
    }

    /* World Settings Modal on Mobile */
    .world-setting-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .setting-input-wrap {
        width: 100%;
    }

    .dialog-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .dialog-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-card {
        padding: 16px;
        max-height: 90vh;
    }
}

