body {
    background-color: #0d1117;
    color: #33ff33;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 20px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#terminal {
    width: 900px;
    height: 600px;
    border: 2px solid #33ff33;
    background-color: #000;
    display: grid;
    grid-template-columns: 275px 1fr 275px;
    grid-template-rows: 80px 1fr 125px;
    gap: 10px;
    padding: 10px;
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.2);
    position: relative;
}

/* Scanlines */
#terminal::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Layout Areas */
header {
    grid-column: 1 / -1;
    border-bottom: 1px dashed #33ff33;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10px;
    font-weight: bold;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Progress Bar */
#progress-container {
    width: 100%;
    height: 15px;
    border: 1px solid #555;
    background-color: #111;
    position: relative;
}

#progress-bar {
    height: 100%;
    background-color: #33ff33;
    width: 0%;
    transition: width 0.3s;
}

#progress-text {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #000;
    line-height: 15px;
    font-weight: bold;
}

#left-panel {
    grid-column: 1;
    border-right: 1px dashed #33ff33;
    padding: 10px;
    overflow-y: auto;
    overflow-x: visible;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#left-panel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

#center-panel {
    grid-column: 2;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#center-panel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

#right-panel {
    grid-column: 3;
    border-left: 1px dashed #33ff33;
    padding: 10px;
    overflow-y: auto;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#right-panel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

#log-panel {
    grid-column: 1 / -1;
    border-top: 1px dashed #33ff33;
    padding: 10px;
    overflow-y: auto;
    font-size: 0.9em;
    color: #aaffaa;
}

/* UI Elements */
.btn {
    background: transparent;
    border: 1px solid #33ff33;
    color: #33ff33;
    padding: 5px 10px;
    margin: 5px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    font-size: 0.85em;
}
a.btn {
    text-decoration: none;
    font-weight: normal;
    display: inline-block;
}
.btn:hover {
    background: #33ff33;
    color: #000;
}
.btn:disabled {
    border-color: #555;
    color: #555;
    cursor: not-allowed;
}

.item-slot {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    cursor: pointer;
}
.item-slot:hover {
    background-color: #113311;
}
.item-slot.selected {
    background-color: #33ff33;
    color: #000;
}

.ascii-art {
    white-space: pre;
    font-size: 10px;
    line-height: 10px;
    margin-bottom: 20px;
    text-align: center;
}

h3 { margin: 0 0 10px 0; border-bottom: 1px solid #555; padding-bottom: 5px; }

/* Log message types */
.log-action     { color: #aaffaa; }
.log-customer   { color: #77ddff; }
.log-system     { color: #ffff00; }
.log-artifact   { color: #ffaa00; }
.log-consumable { color: #cc99ff; }
.log-merchant   { color: #ffdd44; }
.log-error      { color: #ff5555; }
.log-narrative  { color: #ff6699; }

.game-over {
    color: #ff3333;
    font-weight: bold;
    font-size: 1em;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9;
}

/* Modal Styles */
.modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #000;
    border: 2px solid #33ff33;
    padding: 20px;
    z-index: 10;
    width: 350px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 0 30px rgba(51, 255, 51, 0.5);
    text-align: center;
}
.hidden {
    display: none !important;
}
.grid-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

/* Search Input */
.search-input {
    width: 100%;
    background-color: #000;
    border: 1px solid #33ff33;
    color: #33ff33;
    padding: 8px 12px;
    margin-bottom: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #ffff00;
    box-shadow: 0 0 5px rgba(51, 255, 51, 0.3);
}

.search-input::placeholder {
    color: #555;
}

/* Fridge modal: sticky search bar */
.fridge-modal {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
}
.fridge-modal.hidden {
    display: none !important;
}
.fridge-items-scroll {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.sanity-critical { animation: pulse 1s infinite; }
@keyframes pulse {
    0%, 100% { color: #ff3333; }
    50% { color: #ff9999; }
}

/* Artifact Selection Modal */
.artifact-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.artifact-card {
    border: 2px solid #33ff33;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 255, 0, 0.05);
}

.artifact-card:hover {
    background: rgba(0, 255, 0, 0.15);
    border-color: #ffff00;
    transform: translateX(5px);
}

.artifact-name {
    color: #ffff00;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.artifact-description {
    color: #aaffaa;
    margin-bottom: 8px;
}

.artifact-category {
    color: #888888;
    font-size: 0.85em;
    text-transform: uppercase;
}

/* Artifacts Display Section */
#artifacts-section {
    margin-bottom: 10px;
}

.artifact-item {
    padding: 2px 0;
    cursor: help;
    position: relative;
    color: #33ff33;
}

.artifact-item:hover {
    background-color: #113311;
}

/* Tooltip - Reusable component */
.tooltip {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    background-color: #000;
    border: 2px solid #33ff33;
    padding: 8px 12px;
    z-index: 1000;
    width: 220px;
    color: #aaffaa;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(51, 255, 51, 0.4);
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    white-space: normal;
    word-wrap: break-word;
    text-transform: none;
    text-align: left;
}

.tooltip-name {
    color: #ffff00;
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
    border-bottom: 1px solid #33ff33;
    padding-bottom: 3px;
}

.tooltip-description {
    color: #aaffaa;
    font-size: 0.95em;
    line-height: 1.3;
    white-space: pre-line;
}

/* Multi-tooltip container */
.tooltip-container {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tooltip-box {
    background-color: #000;
    border: 2px solid #33ff33;
    padding: 8px 12px;
    width: 220px;
    color: #aaffaa;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(51, 255, 51, 0.4);
    white-space: normal;
    word-wrap: break-word;
    text-transform: none;
    text-align: left;
}

/* Appliance Tooltip for Chef's Intuition */
.appliance-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000;
    border: 2px solid #ffff00;
    padding: 6px 10px;
    margin-bottom: 5px;
    color: #ffff00;
    font-size: 0.85em;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
    animation: fadeIn 0.2s;
}

.appliance-tooltip.success {
    color: #33ff33;
    border-color: #33ff33;
    box-shadow: 0 0 15px rgba(51, 255, 51, 0.5);
}

.appliance-tooltip.fail {
    color: #ff3333;
    border-color: #ff3333;
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Consumables Styles */
.consumables-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
}

/* Morning Merchant Styles (integrated in right panel) */
#merchant-shop h4 {
    margin: 8px 0 5px 0;
    color: #ffff00;
    font-size: 0.9em;
    border-bottom: 1px solid #555;
    padding-bottom: 3px;
}

.merchant-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.merchant-buttons .btn {
    font-size: 0.8em;
    padding: 4px 8px;
    text-align: left;
    position: relative;
}

.merchant-buttons .btn.sold-out {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Settings Button */
.settings-btn {
    background: transparent;
    border: 0px solid #33ff33;
    color: #33ff33;
    padding: 6px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    transition: all 0.2s;
}

.settings-btn svg {
    width: 18px;
    height: 18px;
    fill: #33ff33;
}

.settings-btn:hover {
    background: #33ff33;
    border-color: #33ff33;
}

.settings-btn:hover svg {
    fill: #000;
}

/* Feedback Button */
.feedback-btn {
    background: transparent;
    border: 0px solid #33ff33;
    color: #33ff33;
    padding: 6px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: all 0.2s;
}

.feedback-btn svg {
    width: 18px;
    height: 18px;
    fill: #33ff33;
}

.feedback-btn:hover {
    background: #33ff33;
    border-color: #33ff33;
}

.feedback-btn:hover svg {
    fill: #000;
}

/* Header Right Container */
.header-right {
    display: flex;
    align-items: center;
}

/* Settings Modal */
#settings-modal {
    width: 400px;
    padding: 30px;
}

.settings-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
    min-height: 150px;
}

/* GitHub Button */
.github-btn {
    width: 100%;
    margin: 0 0 15px 0;
    font-size: 1em;
}

/* Exit Button */
.exit-btn {
    margin: 20px 0 0 0;
    width: 100%;
    font-size: 1em;
}

/* Recipe Book View */
.recipe-book-btn {
    width: 100%;
    margin: 0 0 15px 0;
    font-size: 1em;
}

.recipe-book-content {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    margin: 20px 0;
    padding-right: 10px;
}

/* About View */
.about-content {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    margin: 20px 0;
    padding-right: 10px;
    line-height: 1.6;
}

.about-content p {
    margin-bottom: 15px;
}

.about-content strong {
    color: #33ff33;
}

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

.recipe-item {
    padding: 10px 15px;
    border: 1px solid #33ff33;
    background: rgba(0, 255, 0, 0.05);
    cursor: help;
    transition: all 0.2s;
    position: relative;
    overflow: visible;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.recipe-item:hover {
    background: rgba(0, 255, 0, 0.15);
    border-color: #ffff00;
}

.recipe-name {
    color: #ffff00;
    font-weight: bold;
}

.no-recipes {
    text-align: center;
    color: #888;
    padding: 40px 20px;
    line-height: 1.6;
}

/* Keybinds View */
.keybinds-content {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    margin: 20px 0;
    padding-right: 10px;
}

.keybinds-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
}

.keybind-item {
    padding: 10px 15px;
    border: 1px solid #33ff33;
    background: rgba(0, 255, 0, 0.05);
    cursor: help;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.keybind-item:hover {
    background: rgba(0, 255, 0, 0.15);
    border-color: #ffff00;
}

.keybind-label {
    color: #33ff33;
}

.keybind-key {
    color: #ffff00;
    font-weight: bold;
    padding: 2px 8px;
    border: 1px solid #ffff00;
    background: rgba(255, 255, 0, 0.1);
    min-width: 30px;
    text-align: center;
}

/* Payment section in feedback view */
#payment-section h4 {
    margin: 8px 0 5px 0;
    color: #ffff00;
    font-size: 0.9em;
    border-bottom: 1px solid #555;
    padding-bottom: 3px;
}

#feedback-action-btn {
    display: block;
    margin: 10px auto 0 auto;
}

/* Fridge keyboard navigation highlight */
.fridge-highlight {
    outline: 2px solid #ffff00;
    outline-offset: -2px;
    background-color: rgba(255, 255, 0, 0.15);
}

/* Payment items in feedback view */
.item-slot.binded { color: #ff6666; }
.item-slot.binded.selected { background-color: #ff6666; color: #000; }

/* Time Overseer Styles */
#overseer-shop h4 {
    margin: 8px 0 5px 0;
    color: #ffff00;
    font-size: 0.9em;
    border-bottom: 1px solid #555;
    padding-bottom: 3px;
}

/* Culled offerings (Time Overseer) */
.item-slot.culled { color: #aaaaff; }
.item-slot.culled.selected { background-color: #aaaaff; color: #000; }
