/* Forge Calculator - New Layout */

/* Global scrollbar hiding for forge calculator */
.forge-calculator-page,
.forge-calculator-page * {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.forge-calculator-page::-webkit-scrollbar,
.forge-calculator-page *::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
    width: 0;
    height: 0;
}

.forge-calculator-page {
    background: #1a1a1a;
    height: 100vh;
    overflow: hidden;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
}

/* Ensure global-nav works in forge-calculator-page */
.forge-calculator-page .global-nav {
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
}

/* Header */
.forge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #0d0d0d;
    border-bottom: 1px solid #333;
}

.forge-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #d4a44a;
    text-decoration: none;
    letter-spacing: 1px;
}

.forge-nav {
    display: flex;
    gap: 24px;
}

.forge-nav a {
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.forge-nav a:hover,
.forge-nav a.active {
    color: #fff;
}

/* Main Layout - 3 Columns */
.forge-main {
    display: grid;
    grid-template-columns: 240px 1fr 380px;
    flex: 1;
    min-height: 0; /* Important for nested flex/grid scrolling */
    gap: 0;
    overflow: hidden;
}

/* Left Sidebar - Forge Chances */
.forge-chances-sidebar {
    background: #141414;
    padding: 10px 12px;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.forge-chances-sidebar .sidebar-header h2 {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

/* Region Selector Dropdown */
.region-selector {
    margin-bottom: 8px;
}

.region-label {
    display: block;
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.region-dropdown {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.region-dropdown:hover {
    border-color: #666;
}

.region-dropdown:focus {
    outline: none;
    border-color: #d4a44a;
}

.region-dropdown option {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 8px;
}

/* Legacy world-btn styles for backwards compatibility */
.world-toggle {
    margin-bottom: 6px;
}

.world-btn {
    padding: 4px 10px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
}

.world-btn.active {
    background: #3a3a3a;
    border-color: #666;
}

.ore-count-display {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 10px;
}

/* Chance List */
.chance-list {
    flex: 1;
    overflow-y: auto;
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.chance-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.chance-item {
    margin-bottom: 8px;
}

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

.chance-item-name {
    font-size: 0.8rem;
    color: #e0e0e0;
}

.chance-item-percent {
    font-size: 0.75rem;
    color: #d4a44a;
    font-weight: 600;
}

.chance-bar {
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px;
    overflow: hidden;
}

.chance-bar-fill {
    height: 100%;
    background: #d4a44a;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.chance-bar-fill.optimal {
    background: #22c55e;
}

.chance-bar-fill.craftable {
    background: #3b82f6;
}

.chance-bar-fill.locked {
    background: #444;
}

.chance-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.chance-item-percent.low-chance {
    color: #ef4444;
    font-weight: 700;
}

.chance-item-percent.high-chance {
    color: #20c997;
    font-weight: 700;
}

.chance-item-range {
    font-size: 0.65rem;
    color: #666;
    margin-left: auto;
    margin-right: 8px;
    font-family: monospace;
}

/* Weapon Variants under each type */
.weapon-variants {
    margin-top: 8px;
    padding-left: 8px;
    border-left: 2px solid #333;
}

.weapon-variants.active {
    border-left-color: #d4a44a;
}

.weapon-variants.locked {
    opacity: 0.5;
}

.variant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 2px;
    font-size: 0.75rem;
    color: #888;
    background: #1a1a1a;
    border-radius: 3px;
}

.weapon-variants.active .variant-item {
    color: #ccc;
}

.variant-item.limited {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.variant-item.limited .variant-name {
    color: #ef4444;
}

.variant-name {
    font-weight: 500;
}

.variant-chance {
    font-size: 0.7rem;
    color: #666;
    font-family: monospace;
}

.weapon-variants.active .variant-chance {
    color: #d4a44a;
}

.chance-tip {
    margin-top: 10px;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #666;
    line-height: 1.3;
}

/* Saved Builds Section */
.saved-builds-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.saved-builds-section h3 {
    font-size: 0.8rem;
    color: #888;
    margin: 0 0 12px 0;
    letter-spacing: 1px;
}

.save-build-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.save-build-form input {
    flex: 1;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.save-build-form input::placeholder {
    color: #555;
}

.save-build-form input:focus {
    outline: none;
    border-color: #d4a44a;
}

.save-build-btn {
    padding: 8px 10px;
    background: #d4a44a;
    border: none;
    border-radius: 4px;
    color: #000;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.save-build-btn:hover {
    background: #e0b35a;
}

/* Build Tags Input */
.build-tags-input {
    margin-bottom: 8px;
}

.build-tags-input input {
    width: 100%;
    padding: 6px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    box-sizing: border-box;
}

.build-tags-input input::placeholder {
    color: #555;
}

.build-tags-input input:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Build Filter Section */
.build-filter-section {
    margin-bottom: 10px;
}

.build-filter-section input {
    width: 100%;
    padding: 6px 10px;
    background: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    box-sizing: border-box;
}

.build-filter-section input::placeholder {
    color: #555;
}

.build-filter-section input:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Build Tags Display */
.saved-build-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.build-tag {
    background: #2a2a3a;
    color: #8a8aff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 500;
}

.build-tag.matched {
    background: #3a4a3a;
    color: #8aff8a;
}

.saved-builds-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.saved-builds-list::-webkit-scrollbar {
    display: none;
}

.saved-build-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-build-item:hover {
    border-color: #d4a44a;
    background: #222;
}

.saved-build-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

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

.saved-build-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-build-meta {
    font-size: 0.65rem;
    color: #666;
}

.saved-build-delete {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 3px;
    color: #888;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
}

.saved-build-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.saved-builds-empty {
    font-size: 0.75rem;
    color: #555;
    text-align: center;
    padding: 16px 8px;
}

/* Center - Forge Preview - NEW BOX LAYOUT */
.forge-preview {
    background: #0d0d0d;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
}

/* Forge Stats Box */
.forge-stats-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.forge-stats-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.stats-icon {
    font-size: 1rem;
}

.stats-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.ore-type-count {
    font-size: 0.75rem;
    color: #666;
    margin-left: auto;
}

.forge-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.stat-card-label {
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4a44a;
}

.stat-card-value.damage {
    color: #ef4444;
}

/* Predicted Type Box */
.predicted-type-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.predicted-type-label {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.predicted-type-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ef4444;
}

/* Variants Box */
.variants-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.variants-label {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variants-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variant-badge {
    background: #2563eb;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.variant-badge:hover {
    background: #3b82f6;
    transform: scale(1.05);
}

.variant-badge.selected {
    background: #1d4ed8;
    border-color: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.variant-badge.limited {
    background: #dc2626;
}

.variant-badge.limited:hover {
    background: #ef4444;
}

.variant-badge.limited.selected {
    background: #b91c1c;
    border-color: #fbbf24;
}

.variant-badge.armor {
    background: #14b8a6;
}

.variant-badge.armor:hover {
    background: #2dd4bf;
}

.variant-badge.armor.selected {
    background: #0d9488;
    border-color: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* Selected Ores Box */
.selected-ores-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.selected-ores-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.selected-ores-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.clear-all-btn {
    background: #dc2626;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-all-btn:hover {
    background: #b91c1c;
}

.selected-ores-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}

/* Selected Ore Badge Style */
.selected-ore-badge {
    background: #2a2a2a;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #444;
    user-select: none;
}

.selected-ore-badge:hover {
    background: #3a3a3a;
    border-color: #d4a44a;
}

.selected-ore-badge:active {
    transform: scale(0.95);
}

/* Rarity colors for badges */
.selected-ore-badge.common { border-left: 3px solid #a0a0a0; }
.selected-ore-badge.uncommon { border-left: 3px solid #4ade80; }
.selected-ore-badge.rare { border-left: 3px solid #60a5fa; }
.selected-ore-badge.epic { border-left: 3px solid #a855f7; }
.selected-ore-badge.legendary { border-left: 3px solid #facc15; }
.selected-ore-badge.mythical { border-left: 3px solid #f472b6; }
.selected-ore-badge.relic { border-left: 3px solid #ef4444; }
.selected-ore-badge.divine { border-left: 3px solid #22d3ee; }

.selected-ore-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
}

.selected-ore-item:hover {
    border-color: #d4a44a;
    background: #222;
}

.selected-ore-info {
    display: flex;
    flex-direction: column;
}

.selected-ore-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}

.selected-ore-mult {
    font-size: 0.7rem;
    color: #888;
}

.selected-ore-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: #d4a44a;
}

.selected-ore-hint {
    font-size: 0.65rem;
    color: #555;
}

.empty-slot {
    color: #555;
    font-size: 0.8rem;
    text-align: center;
    padding: 12px;
}

.selected-ores-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
    font-size: 0.8rem;
    color: #888;
}

.selected-ores-footer strong {
    font-size: 1.2rem;
    color: #fff;
}

/* Composition & Traits Box */
.composition-traits-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.comp-traits-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.comp-section,
.traits-section {
    margin-bottom: 8px;
}

.comp-section:last-child,
.traits-section:last-child {
    margin-bottom: 0;
}

.comp-section-title,
.traits-section-title {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.composition-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.composition-item .ore-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    margin-right: 8px;
    min-width: 80px;
}

.composition-bar {
    flex: 1;
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
    margin-right: 8px;
}

.composition-bar-fill {
    height: 100%;
    background: #d4a44a;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.composition-item .ore-percent {
    font-size: 0.75rem;
    color: #888;
    min-width: 40px;
    text-align: right;
}

.empty-hint {
    font-size: 0.75rem;
    color: #555;
    margin: 0;
}

.trait-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 6px 10px;
    margin-bottom: 4px;
}

.trait-item:last-child {
    margin-bottom: 0;
}

.trait-ore-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #d4a44a;
    margin-bottom: 2px;
}

.trait-text {
    font-size: 0.75rem;
    color: #ccc;
}

.trait-effectiveness {
    font-size: 0.65rem;
    color: #888;
    margin-top: 2px;
}

/* Masterwork Box */
.masterwork-box {
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 10px 14px;
}

.masterwork-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.masterwork-percent {
    color: #d4a44a;
    font-weight: 700;
}

.masterwork-box input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #2a2a2a;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.masterwork-box input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d4a44a;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.masterwork-range {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7rem;
    color: #888;
}

.masterwork-range span span {
    color: #d4a44a;
    font-weight: 600;
}

/* Armor Mode Colors */
.forge-preview.armor-mode .stat-card-value {
    color: #14b8a6;
}

.forge-preview.armor-mode .predicted-type-name {
    color: #14b8a6;
}

.forge-preview.armor-mode .variant-badge {
    background: #14b8a6;
}

.forge-preview.armor-mode .composition-bar-fill {
    background: #14b8a6;
}

.forge-preview.armor-mode .trait-ore-name {
    color: #14b8a6;
}

.forge-preview.armor-mode .masterwork-percent,
.forge-preview.armor-mode .masterwork-range span span {
    color: #14b8a6;
}

.forge-preview.armor-mode .masterwork-box input[type="range"]::-webkit-slider-thumb {
    background: #14b8a6;
}

/* Right Sidebar - Ore Selection */
.ore-selection-sidebar {
    background: #141414;
    padding: 10px 12px;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.ore-selection-sidebar .sidebar-header {
    margin-bottom: 8px;
}

.ore-selection-sidebar .sidebar-header h2 {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.ore-selection-sidebar input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
}

.ore-selection-sidebar input[type="text"]::placeholder {
    color: #555;
}

/* Ore Grid */
.ore-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px 0;
    align-content: start;
}

.ore-grid-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 8px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ore-grid-item:hover {
    border-color: #d4a44a;
    background: #222;
}

.ore-grid-item.selected {
    border-color: #d4a44a;
    background: #2a2518;
}

/* Ore Grid Image */
.ore-grid-item .ore-grid-image {
    width: 36px;
    height: 36px;
    object-fit: contain;
    margin: 0 auto 4px auto;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.ore-grid-item .ore-name {
    font-size: 0.7rem;
    color: #e0e0e0;
    font-weight: 600;
    margin-bottom: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.1;
}

.ore-grid-item .ore-mult {
    font-size: 0.65rem;
    color: #d4a44a;
    font-weight: 500;
}

.ore-grid-item .ore-selected-badge {
    font-size: 0.6rem;
    color: #22c55e;
    margin-top: 2px;
    font-weight: 600;
}

/* Verified/Unverified Badges */
.verified-badge {
    color: #22c55e;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 2px;
}

.unverified-badge {
    color: #f59e0b;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 2px;
}

/* Data Version Info */
#data-version-info {
    font-size: 0.7rem;
    color: #666;
    margin-top: 4px;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #333;
    margin-top: 8px;
}

.mode-toggle .mode-btn {
    flex: 1;
    padding: 8px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-toggle .mode-btn:hover {
    border-color: #666;
    color: #fff;
}

.mode-toggle .mode-btn.active {
    background: #d4a44a;
    border-color: #d4a44a;
    color: #000;
}

.mode-toggle .mode-btn.armor-active {
    background: #20c997;
    border-color: #20c997;
    color: #000;
}

/* Armor Mode Styling */
.chance-item.armor-mode .chance-bar-fill.optimal {
    background: linear-gradient(90deg, #20c997 0%, #17a085 100%);
}

.chance-item.armor-mode .chance-bar-fill.craftable {
    background: linear-gradient(90deg, #3dd9a8 0%, #20c997 100%);
}

.ring-outer.armor-mode {
    background: conic-gradient(
        #20c997 0deg,
        #20c997 var(--ring-percent, 0deg),
        #333 var(--ring-percent, 0deg),
        #333 360deg
    );
}

/* Ore Trait Tooltip (Rechtsklick) */
.ore-trait-tooltip {
    position: fixed;
    background: #1a1a1a;
    border: 1px solid #d4a44a;
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 300px;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: tooltipFadeIn 0.15s ease-out;
    pointer-events: none;
}

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

.ore-trait-tooltip .tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.ore-trait-tooltip .tooltip-ore-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.ore-trait-tooltip .tooltip-rarity {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-rarity.common { background: #6b7280; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.uncommon { background: #22c55e; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.rare { background: #3b82f6; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.epic { background: #a855f7; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.legendary { background: #f59e0b; color: #000; }
.ore-trait-tooltip .tooltip-rarity.mythical { background: #ef4444; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.relic { background: #ec4899; color: #fff; }
.ore-trait-tooltip .tooltip-rarity.divine { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #000; }

.ore-trait-tooltip .tooltip-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.ore-trait-tooltip .tooltip-stat {
    color: #888;
}

.ore-trait-tooltip .tooltip-stat span {
    color: #d4a44a;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-trait {
    font-size: 0.85rem;
    color: #e0e0e0;
    line-height: 1.4;
    padding: 8px;
    background: #222;
    border-radius: 4px;
    border-left: 3px solid #d4a44a;
}

.ore-trait-tooltip .tooltip-trait-type {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.ore-trait-tooltip .tooltip-trait-type.weapon { background: #ef4444; color: #fff; }
.ore-trait-tooltip .tooltip-trait-type.armor { background: #3b82f6; color: #fff; }
.ore-trait-tooltip .tooltip-trait-type.both { background: #a855f7; color: #fff; }

.ore-trait-tooltip .no-trait {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* ==========================================
   MOBILE NAVIGATION BUTTONS
   ========================================== */

.mobile-nav-buttons {
    display: none; /* Hidden on desktop */
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 2px solid #333;
    border-radius: 10px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    min-height: 50px;
}

.mobile-nav-btn .nav-btn-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.mobile-nav-btn .nav-btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.2;
}

.mobile-nav-btn:hover {
    border-color: #555;
    color: #aaa;
}

.mobile-nav-btn:active {
    transform: scale(0.97);
}

.mobile-nav-btn.active {
    background: linear-gradient(180deg, #2a2010 0%, #1a1508 100%);
    border-color: #d4a44a;
    color: #d4a44a;
    box-shadow: 0 0 15px rgba(212, 164, 74, 0.25);
}

.mobile-nav-btn.active .nav-btn-icon {
    filter: drop-shadow(0 0 4px rgba(212, 164, 74, 0.5));
}

/* Armor mode colors */
.mobile-nav-buttons.armor-mode .mobile-nav-btn.active {
    background: linear-gradient(180deg, #102a2a 0%, #081a1a 100%);
    border-color: #14b8a6;
    color: #14b8a6;
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.25);
}

.mobile-nav-buttons.armor-mode .mobile-nav-btn.active .nav-btn-icon {
    filter: drop-shadow(0 0 4px rgba(20, 184, 166, 0.5));
}

/* ==========================================
   MOBILE TAB NAVIGATION SYSTEM
   ========================================== */

/* Mobile Tab Bar - Fixed at bottom */
.forge-mobile-tabs {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-top: 1px solid #333;
    z-index: 1000;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
}

.forge-mobile-tabs .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #666;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 52px;
    gap: 4px;
}

.forge-mobile-tabs .mobile-tab .tab-icon {
    font-size: 1.2rem;
}

.forge-mobile-tabs .mobile-tab .tab-label {
    font-weight: 500;
    letter-spacing: 0.5px;
}

.forge-mobile-tabs .mobile-tab:hover {
    color: #888;
    background: rgba(255, 255, 255, 0.05);
}

.forge-mobile-tabs .mobile-tab.active {
    color: #d4a44a;
    background: rgba(212, 164, 74, 0.1);
    border-color: rgba(212, 164, 74, 0.3);
}

.forge-mobile-tabs .mobile-tab.active .tab-icon {
    transform: scale(1.1);
}

/* Armor mode tab styling */
.forge-mobile-tabs.armor-mode .mobile-tab.active {
    color: #20c997;
    background: rgba(32, 201, 151, 0.1);
    border-color: rgba(32, 201, 151, 0.3);
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */

/* Large Desktop */
@media (max-width: 1200px) {
    .forge-main {
        grid-template-columns: 200px 1fr 280px;
    }

    .ore-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet Landscape / Small Desktop */
@media (max-width: 1024px) {
    .forge-main {
        grid-template-columns: 180px 1fr 260px;
    }

    .forge-chances-sidebar,
    .ore-selection-sidebar {
        padding: 12px;
    }

    .preview-ring {
        max-width: 260px;
    }
}

/* Tablet Portrait - Switch to Mobile Layout */
@media (max-width: 900px) {
    /* Show mobile navigation buttons */
    .mobile-nav-buttons {
        display: grid;
    }

    /* Hide old mobile tabs */
    .forge-mobile-tabs {
        display: none;
    }

    /* Switch to single column */
    .forge-main {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* Hide sidebars by default (shown via JS) */
    .forge-chances-sidebar,
    .ore-selection-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 500;
        background: #141414;
        overflow-y: auto;
        padding: 16px;
        animation: slideUp 0.25s ease-out;
    }

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

    /* Show sidebars when active */
    .forge-chances-sidebar.mobile-active,
    .ore-selection-sidebar.mobile-active {
        display: flex;
    }

    /* Adjust preview for mobile */
    .forge-preview {
        padding-bottom: 80px; /* Space for mobile tabs */
        overflow-y: auto;
    }

    /* Hide footer on mobile (it gets hidden behind tabs) */
    body.forge-calculator-page footer {
        display: none;
    }

    /* Ore grid - 3 columns on tablet */
    .ore-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    /* Mode toggle at bottom of ore sidebar */
    .ore-selection-sidebar .mode-toggle {
        position: sticky;
        bottom: 0;
        background: #141414;
        padding: 12px 0;
        margin-top: auto;
    }

    /* Close button for mobile sidebars */
    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 50%;
        color: #888;
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 10;
    }

    .mobile-close-btn:hover {
        background: #333;
        color: #fff;
    }
}

/* Large Phone */
@media (max-width: 640px) {
    .forge-preview {
        padding: 12px;
        padding-bottom: 80px;
    }

    .preview-ring {
        max-width: 240px;
        min-width: 200px;
    }

    .weapon-name {
        font-size: 1rem;
    }

    .weapon-chance {
        font-size: 0.8rem;
    }

    .stat-line {
        font-size: 0.65rem;
    }

    .predicted-label {
        font-size: 0.5rem;
    }

    .selected-ores-section {
        padding: 8px;
    }

    .selected-ores-grid {
        gap: 4px;
        padding: 4px;
    }

    .selected-ore-item {
        padding: 4px 6px;
        min-width: 55px;
    }

    .selected-ore-name {
        font-size: 0.65rem;
    }

    .selected-ore-count {
        font-size: 0.6rem;
    }

    .composition-traits-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .masterwork-section {
        padding: 8px;
    }

    /* Ore grid - 2 columns on phone */
    .ore-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .ore-grid-item {
        padding: 10px 6px;
        min-height: 50px;
    }

    .ore-grid-item .ore-name {
        font-size: 0.7rem;
    }

    .ore-grid-item .ore-mult {
        font-size: 0.7rem;
    }

    /* Chance list items */
    .chance-item-name {
        font-size: 0.8rem;
    }

    .chance-item-percent {
        font-size: 0.75rem;
    }

    .variant-item {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    /* Save build form */
    .save-build-form input {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px;
    }

    .save-build-btn {
        padding: 12px 14px;
        font-size: 0.8rem;
    }

    /* Sidebar headers */
    .forge-chances-sidebar .sidebar-header h2,
    .ore-selection-sidebar .sidebar-header h2 {
        font-size: 0.85rem;
    }

    /* Search input */
    .ore-selection-sidebar input[type="text"] {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px;
    }
}

/* Small Phone */
@media (max-width: 380px) {
    .preview-ring {
        max-width: 200px;
        min-width: 180px;
    }

    .weapon-name {
        font-size: 0.9rem;
    }

    .ring-inner {
        padding: 12px;
    }

    .selected-ore-item {
        min-width: 50px;
        padding: 3px 5px;
    }

    .ore-grid-item {
        padding: 8px 4px;
    }

    .forge-mobile-tabs {
        padding: 6px 8px;
    }

    .forge-mobile-tabs .mobile-tab {
        padding: 8px 4px;
        min-height: 48px;
    }

    .forge-mobile-tabs .mobile-tab .tab-icon {
        font-size: 1rem;
    }

    .forge-mobile-tabs .mobile-tab .tab-label {
        font-size: 0.6rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .ore-grid-item {
        min-height: 54px;
    }

    .mode-btn {
        min-height: 48px;
    }

    .world-btn {
        min-height: 44px;
        padding: 10px 14px;
    }

    .save-build-btn {
        min-height: 44px;
    }

    .saved-build-item {
        padding: 12px;
    }

    .saved-build-delete {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 12px;
    }
}

/* Build Modal Overlay */
.build-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.build-modal {
    background: #1a1a1a;
    border: 2px solid #d4a44a;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.build-modal-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.build-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.build-modal-icon {
    font-size: 1.8rem;
}

.build-modal-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4a44a;
}

.build-modal-build-name {
    font-size: 0.9rem;
    color: #888;
}

.build-modal-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.build-modal-stat {
    background: #141414;
    padding: 14px;
    border-radius: 8px;
    text-align: center;
}

.build-modal-stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.build-modal-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.build-modal-stat-value.damage { color: #ef4444; }
.build-modal-stat-value.multiplier { color: #3b82f6; }
.build-modal-stat-value.masterwork { color: #d4a44a; }
.build-modal-stat-value.ores { color: #22c55e; }

.build-modal-section {
    margin-bottom: 16px;
}

.build-modal-section-title {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 600;
}

.build-modal-ores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.build-modal-ore {
    background: #2a2a2a;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #e0e0e0;
}

.build-modal-traits {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.build-modal-trait {
    background: #141414;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #d4a44a;
}

.build-modal-trait-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.build-modal-trait-ore {
    font-size: 0.85rem;
    font-weight: 600;
    color: #d4a44a;
}

.build-modal-trait-effectiveness {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.build-modal-trait-effectiveness.full {
    background: rgba(32, 201, 151, 0.2);
    color: #20c997;
}

.build-modal-trait-effectiveness.medium {
    background: rgba(255, 212, 59, 0.2);
    color: #ffd43b;
}

.build-modal-trait-effectiveness.low {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.build-modal-trait-text {
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
}

.build-modal-no-traits {
    text-align: center;
    color: #555;
    font-size: 0.85rem;
    padding: 16px;
    background: #141414;
    border-radius: 8px;
}

.build-modal-close {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    background: #d4a44a;
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.build-modal-close:hover {
    background: #c49a40;
}

/* Combined stats display */
.build-modal-combined-stats {
    background: #141414;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.build-modal-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #2a2a2a;
}

.build-modal-stat-row:last-child {
    border-bottom: none;
}

.build-modal-stat-name {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 500;
}

.build-modal-stat-value-combined {
    font-size: 1rem;
    font-weight: 700;
    color: #22c55e;
}

.build-modal-other-traits {
    margin-top: 8px;
}

.build-modal-other-title {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
    font-weight: 600;
}

.build-modal-trait {
    background: #141414;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.build-modal-trait:last-child {
    margin-bottom: 0;
}

.build-modal-trait-ore {
    font-size: 0.8rem;
    font-weight: 600;
    color: #d4a44a;
}

.build-modal-trait-text {
    font-size: 0.8rem;
    color: #ccc;
}

/* Mobile responsiveness for build modal */
@media (max-width: 480px) {
    .build-modal {
        padding: 16px;
        max-height: 90vh;
    }

    .build-modal-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .build-modal-stat {
        padding: 10px;
    }

    .build-modal-stat-value {
        font-size: 1rem;
    }

    .build-modal-name {
        font-size: 1.2rem;
    }
}
