:root {
    --bg-main:       #f0f4ff;
    --bg-card:       #ffffff;
    --bg-panel:      #ffffff;
    --bg-soft:       #f7f9fe;

    --blue:          #6b9ff7;
    --blue-dark:     #4a7fe6;
    --blue-light:    #dce9ff;

    --green:         #6fcf97;
    --green-dark:    #27ae60;
    --green-light:   #d4f5e4;

    --red:           #f47d7d;
    --red-dark:      #e74c3c;
    --red-light:     #fde8e8;

    --purple:        #a78bfa;
    --purple-dark:   #7c3aed;
    --purple-light:  #ede9fe;

    --yellow:        #f9c74f;
    --yellow-dark:   #f39c12;
    --yellow-light:  #fff8e1;

    --text-main:     #2d3436;
    --text-mid:      #636e72;
    --text-soft:     #b2bec3;

    --border:        #e0e7ff;
    --shadow-sm:     0 2px 8px rgba(107,159,247,0.10);
    --shadow-md:     0 6px 24px rgba(107,159,247,0.14);
    --shadow-lg:     0 12px 40px rgba(107,159,247,0.18);
    --radius:        14px;
    --radius-sm:     8px;
    --radius-lg:     20px;

    --font-main:     'Nunito', sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(167,139,250,0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(107,159,247,0.12) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c7d7fd' fill-opacity='0.25'%3E%3Ccircle cx='30' cy='30' r='1.5'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.game-container {
    display: flex;
    flex-direction: column; 
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.game-header {
    background: linear-gradient(135deg, #667eea 0%, #a78bfa 100%);
    color: white;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(102,126,234,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.player-stats h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.stats-row {
    display: flex;
    gap: 28px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 0.78rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.economy-stats {
    display: flex;
    gap: 16px;
    background: rgba(255,255,255,0.18);
    padding: 10px 18px;
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.25);
}

.economy-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.econ-label {
    font-size: 0.78rem;
    opacity: 0.8;
}

.econ-val {
    font-size: 1rem;
    font-weight: 700;
}

.game-main {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 18px;
    align-items: flex-start;
}

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

.businesses-panel {
    flex: 0 0 290px;
    border-top: 4px solid var(--blue);
}

.control-panel {
    flex: 1;
    border-top: 4px solid var(--green);
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.control-panel > * {
    position: relative;
    z-index: 2;
}

.analytics-panel {
    flex: 0 0 300px;
    border-top: 4px solid var(--purple);
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--bg-soft);
}

.panel-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:hover   { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active  { transform: translateY(0); }

.btn-primary  { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); color: white; }
.btn-danger   { background: linear-gradient(135deg, var(--red), var(--red-dark));   color: white; }
.btn-info     { background: linear-gradient(135deg, #74b9ff, #0984e3);              color: white; }
.btn-secondary{ background: #dfe6e9; color: var(--text-mid); }
.btn-success  { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: white; }
.btn-warning  { background: linear-gradient(135deg, var(--yellow), var(--yellow-dark)); color: white; }
.btn-small    { padding: 7px 14px; font-size: 0.85rem; }
.btn-large    { padding: 13px 28px; font-size: 1rem; }

.btn-disabled {
    background: #dfe6e9 !important;
    color: #b2bec3 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    transform: none !important;
    box-shadow: none !important;
}

.companies-list {
    max-height: calc(100vh - 230px);
    overflow-y: auto;
    padding-right: 4px;
}

.company-card {
    background: var(--bg-soft);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-card:hover {
    border-color: var(--blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.company-card.selected {
    border-color: var(--green);
    background: var(--green-light);
    box-shadow: 0 4px 16px rgba(111,207,151,0.25);
}

.company-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.company-icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.company-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.company-title h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-type {
    font-size: 0.76rem;
    color: var(--text-mid);
    background: var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 3px;
}

.company-profit {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    max-width: 100%;
    white-space: normal;
}

.profit-positive { color: var(--green-dark); background: var(--green-light); }
.profit-negative { color: var(--red-dark);   background: var(--red-light);   }

.company-details {
    background: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px solid var(--bg-soft);
    font-size: 0.88rem;
    gap: 8px;
}

.detail-row:last-child { border-bottom: none; }

.detail-value {
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.btn-select-company {
    width: 100%;
    padding: 9px;
    background: var(--blue-light);
    color: var(--blue-dark);
    border: 2px solid var(--blue);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.88rem;
    transition: all 0.2s;
}

.btn-select-company:hover {
    background: var(--blue);
    color: white;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.selected-name {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-main);
}

.controls-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.control-group {
    flex: 1;
    min-width: 180px;
}

.control-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-mid);
}

.input-with-button {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-button input {
    flex: 1;
    padding: 9px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: var(--bg-soft);
}

.input-with-button input:focus {
    outline: none;
    border-color: var(--blue);
    background: white;
}

.input-with-button input:disabled {
    background: #f1f4fd;
    color: var(--text-soft);
    cursor: not-allowed;
}

.input-badge {
    background: var(--purple-light);
    color: var(--purple-dark);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-container {
    height: 220px;
    background: var(--bg-soft);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px;
    margin-bottom: 16px;
}

.mascot-image {
    position: absolute;
    right: -16px;
    bottom: -10px;
    width: min(18.5vw, 225px);
    max-width: 22%;
    opacity: 0.82;
    filter: brightness(0.92) contrast(0.9) blur(0.8px);
    pointer-events: none;
    user-select: none;
    z-index: 1;
    transform: translateY(18px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.9s ease, transform 0.9s ease;
}

body.page-ready .mascot-image {
    opacity: 0.88;
    transform: translateY(0) scale(1);
}

.company-details-panel {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 20px;
    border-left: 4px solid var(--blue);
    animation: fadeIn 0.3s ease;
}

.company-details-panel h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.simple-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.detail-item {
    background: white;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.detail-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-mid);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.formula-item {
    grid-column: span 2;
}

.formula-demand {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--blue-dark);
    background: var(--blue-light);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--blue);
    display: inline-block;
    word-break: break-all;
}

.formula-cost {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--red-dark);
    background: var(--red-light);
    padding: 4px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--red);
    display: inline-block;
    word-break: break-all;
}

.formula-compare {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.formula-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.formula-chip {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
}

.formula-chip-new {
    background: #e6f4ea;
    color: #1f6f43;
}

.formula-chip-old {
    background: #edf1f8;
    color: #52627a;
}

.formula-demand-old,
.formula-cost-old {
    opacity: 0.8;
}

.formula-row { align-items: flex-start; }
.formula-label { font-size: 0.85rem; color: var(--text-mid); }
.formula-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--red-dark);
    background: var(--red-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.shock-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shock-card {
    background: linear-gradient(135deg, #fff7e6 0%, #ffffff 100%);
    border: 1px solid #ffe3b0;
    border-left: 4px solid var(--yellow-dark);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

.shock-card h4 {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-main);
}

.shock-card p {
    font-size: 0.84rem;
    color: var(--text-mid);
    line-height: 1.45;
    margin-bottom: 8px;
}

.shock-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-mid);
}

.shock-badge {
    background: var(--yellow-light);
    color: var(--yellow-dark);
    border-radius: 999px;
    padding: 4px 8px;
    font-weight: 700;
}

.profit-checker {
    margin-top: 16px;
    background: var(--yellow-light);
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--yellow-dark);
}

.profit-checker h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.check-correct {
    background: var(--green-light);
    color: var(--green-dark);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
}

.check-wrong {
    background: var(--red-light);
    color: var(--red-dark);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.check-wrong small {
    display: block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    opacity: 0.85;
}

.no-company-message {
    text-align: center;
    padding: 36px 20px 170px;
    color: var(--text-soft);
    max-width: 560px;
    margin: 0 auto;
}

.no-company-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-company-message h3 { color: var(--text-mid); margin-bottom: 8px; font-size: 1.1rem; }
.no-company-message p  { font-size: 0.9rem; }

.quick-analytics {
    background: var(--bg-soft);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.analytics-placeholder {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.analytics-summary h3 {
    font-size: 1rem;
    font-weight: 700;
}

.panel-section { }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.metal-card {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.market-chart-container {
    height: 120px;
    margin: 10px 0 12px;
    padding: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.metal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 0.95rem;
}

.metal-price {
    color: var(--blue-dark);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.metal-qty {
    font-size: 0.82rem;
    color: var(--text-mid);
    margin-bottom: 10px;
}

.metal-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.metal-input {
    width: 64px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font-main);
    background: white;
}

.insider-active {
    background: var(--purple-light);
    color: var(--purple-dark);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.insider-inactive {
    color: var(--text-soft);
    font-size: 0.85rem;
    padding-top: 4px;
}

.game-footer {
    background: white;
    padding: 14px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}

.footer-left, .footer-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.footer-center { flex: 1; text-align: center; }

.round-status {
    font-weight: 600;
    color: var(--text-mid);
    font-size: 0.9rem;
    background: var(--bg-soft);
    padding: 7px 18px;
    border-radius: 20px;
    display: inline-block;
    border: 1px solid var(--border);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45,52,54,0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    animation: fadeInOverlay 0.25s ease;
}

.instruction-open {
    overflow: hidden;
}

.instruction-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 10%, rgba(107,159,247,0.26) 0%, transparent 46%),
        radial-gradient(circle at 85% 85%, rgba(167,139,250,0.24) 0%, transparent 46%),
        rgba(239,244,255,0.95);
    backdrop-filter: blur(3px);
    overflow-y: auto;
}

.instruction-page {
    max-width: 1150px;
    margin: 0 auto;
    border-radius: 24px;
    background: linear-gradient(165deg, #ffffff 0%, #f6f8ff 100%);
    border: 1px solid #d9e3ff;
    box-shadow: 0 16px 44px rgba(88,108,180,0.19);
    padding: 24px;
}

.instruction-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-radius: 18px;
    padding: 18px 22px;
    margin-bottom: 18px;
    border: 1px solid #d6e2ff;
    background: linear-gradient(140deg, #edf2ff 0%, #f4ecff 100%);
}

.instruction-hero-text h2 {
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    font-weight: 800;
    margin-bottom: 8px;
    color: #2f3b5e;
}

.instruction-kicker {
    color: #5878d8;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.instruction-hero-text p {
    color: #4f5f84;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 720px;
}

.instruction-crow {
    width: min(16vw, 140px);
    min-width: 92px;
    filter: drop-shadow(0 9px 14px rgba(93,111,170,0.22));
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 12px;
}

.instruction-stepper {
    border: 1px solid #dbe5ff;
    background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
    border-radius: 16px;
    padding: 16px;
}

.instruction-step-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.instruction-step-counter {
    font-size: 0.84rem;
    font-weight: 800;
    color: #506397;
    background: #eaf0ff;
    border: 1px solid #d2deff;
    border-radius: 999px;
    padding: 4px 10px;
}

.instruction-step-dots {
    display: flex;
    gap: 6px;
}

.instruction-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cfdaf7;
}

.instruction-dot.active {
    background: #648df2;
    transform: scale(1.1);
}

.instruction-step-card {
    background: #fff;
    border: 1px solid #dee6ff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(86,111,182,0.09);
}

.instruction-step-card h3 {
    font-size: 1.06rem;
    margin-bottom: 10px;
    color: #31476e;
}

.instruction-step-body p {
    font-size: 0.92rem;
    line-height: 1.5;
    color: #4c5c7d;
    margin-bottom: 8px;
}

.instruction-step-body ol {
    margin: 8px 0 6px 18px;
    color: #4c5c7d;
}

.instruction-step-body li {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.instruction-card {
    grid-column: span 6;
    background: #fff;
    border: 1px solid #dde6ff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 3px 12px rgba(96,124,193,0.08);
}

.instruction-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #334468;
}

.instruction-card p {
    font-size: 0.9rem;
    line-height: 1.48;
    color: #4c5c7d;
    margin-bottom: 6px;
}

.instruction-card code {
    font-family: var(--font-mono);
    background: #edf3ff;
    color: #3256a7;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 0.84rem;
}

.instruction-card ol,
.instruction-card ul {
    margin: 8px 0 4px 18px;
    color: #4b5a7b;
}

.instruction-card li {
    margin-bottom: 5px;
    font-size: 0.89rem;
    line-height: 1.45;
}

.instruction-note {
    margin-top: 8px;
    color: #3f4e74;
    background: #f2f6ff;
    border-radius: 8px;
    border-left: 3px solid #86a6ff;
    padding: 6px 9px;
}

.instruction-card-warning {
    grid-column: 1 / -1;
    background: linear-gradient(140deg, #fff7df 0%, #fff2cc 100%);
    border-color: #f7db8a;
}

.instruction-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #dbe5ff;
}

.game-over-overlay {
    position: fixed;
    inset: 0;
    z-index: 2300;
    background: rgba(25, 29, 37, 0.62);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.game-over-card {
    width: min(92vw, 520px);
    background: linear-gradient(170deg, #ffffff 0%, #f8faff 100%);
    border: 1px solid #dce6ff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(39, 53, 96, 0.28);
    padding: 24px;
    text-align: center;
}

.game-over-card h2 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    color: #c0392b;
    margin-bottom: 10px;
}

.game-over-card p {
    color: #4f5f84;
    line-height: 1.5;
    margin-bottom: 8px;
}

@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: white;
    padding: 28px;
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header { text-align: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.4rem; font-weight: 800; color: var(--text-main); }
.modal-subtitle  { color: var(--text-mid); font-size: 0.95rem; margin-top: 6px; }

.modal-body { margin: 20px 0; }

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 8px;
}

.company-option {
    background: var(--bg-soft);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s ease;
}

.company-option:hover {
    border-color: var(--blue);
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.company-option.disabled { opacity: 0.55; }
.company-option.disabled:hover { transform: none; border-color: var(--border); box-shadow: none; }

.company-option-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.company-option-header h4 { font-size: 1.1rem; font-weight: 700; }

.company-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--green-dark);
}

.company-description {
    color: var(--text-mid);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 14px;
}

.company-structure {
    font-size: 0.8rem;
    color: var(--text-mid);
    margin-top: 2px;
}

.modal-footer {
    text-align: center;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.game-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: 24px;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.95rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    pointer-events: none;
    white-space: pre-line;
    max-width: min(90vw, 720px);
    text-align: left;
}

.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success { background: var(--green-dark); color: white; }
.toast-error   { background: var(--red-dark);   color: white; }

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

.business-controls { animation: fadeIn 0.25s ease; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

@media (max-width: 1200px) {
    .game-main { flex-direction: column; }
    .businesses-panel, .analytics-panel { flex: 0 0 auto; width: 100%; max-height: none; }
    .control-panel {
        display: flex;
        flex-direction: column;
    }
    .mascot-image {
        position: relative;
        right: auto;
        bottom: auto;
        width: min(28vw, 160px);
        max-width: 160px;
        margin: 8px 0 0 auto;
        opacity: 0.76;
        transform-origin: center;
    }
}

@media (max-width: 768px) {
    .game-header { flex-direction: column; gap: 12px; }
    .economy-stats { flex-wrap: wrap; justify-content: center; }
    .game-footer { flex-direction: column; gap: 10px; }
    .footer-left, .footer-right, .footer-center { width: 100%; justify-content: center; }
    .companies-grid { grid-template-columns: 1fr; }
    .controls-row { flex-direction: column; }
    .formula-item { grid-column: span 1; }
    .mascot-image {
        width: min(34vw, 126px);
        max-width: 126px;
        margin: 10px auto 0;
        opacity: 0.7;
    }
    .instruction-overlay {
        padding: 12px;
    }
    .instruction-page {
        padding: 14px;
        border-radius: 16px;
    }
    .instruction-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .instruction-crow {
        width: min(38vw, 130px);
        align-self: center;
    }
    .instruction-card {
        grid-column: 1 / -1;
    }
    .instruction-actions {
        flex-direction: column;
    }
    .instruction-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
