@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Display&display=swap');

:root {
    --green-dark:  #1a3a2a;
    --green-mid:   #2d6a4f;
    --green-light: #52b788;
    --green-pale:  #d8f3dc;
    --bg:          #6b7c6e;
    --card:        #ffffff;
    --card-alt:    #f2f7f4;
    --text:        #1c2b22;
    --text-muted:  #4a5e52;
    --border:      #c5d9cc;
    --row-hover:   #c7ead2;
    --accent:      #e07b39;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--bg);
    min-height: 100vh;
    color: var(--text);
}

#container {
    width: 1100px;
    margin: 0 auto;
    background-color: #e8f0eb;
    padding: 30px;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.25);
}

header h1 {
    font-family: 'DM Serif Display', serif;
    background-color: var(--green-dark);
    padding: 18px 24px;
    border-radius: 8px;
    font-size: 26pt;
    text-align: center;
    color: white;
    letter-spacing: 0.01em;
}

.navigation {
    background-color: var(--green-mid);
    border-radius: 8px;
    margin-top: 14px;
    margin-bottom: 28px;
    padding: 10px 0;
}

nav {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
}

nav a {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-weight: 600;
    font-size: 13pt;
    padding: 7px 18px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

nav a:hover,
nav a.active {
    background: rgba(255,255,255,0.16);
    color: white;
}

.line {
    width: 100%;
    height: 2px;
    background-color: var(--green-light);
    margin-bottom: 14px;
}

.section_title {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 16pt;
    margin-bottom: 10px;
}

.hero {
    background-color: var(--green-dark);
    border-radius: 8px;
    padding: 32px 28px;
    color: white;
}

.hero h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 19pt;
    margin-bottom: 12px;
    color: var(--green-pale);
}

.hero p {
    font-size: 11.5pt;
    line-height: 1.75;
    color: rgba(255,255,255,0.87);
    max-width: 820px;
}

.assumptions {
    background: var(--card);
    border-radius: 8px;
    padding: 20px 24px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.assumptions h2 {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 15pt;
    margin-bottom: 10px;
}

.assumptions ul {
    list-style: none;
    padding: 0;
}

.assumptions ul li {
    padding: 8px 0 8px 20px;
    position: relative;
    font-size: 11pt;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    line-height: 1.65;
}

.assumptions ul li:last-child { border-bottom: none; }

.assumptions ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--green-mid);
    font-weight: 700;
}

.dataset {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.table_wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 16px;
    margin-bottom: 8px;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 10.5pt;
}

th, td {
    border: 1px solid var(--border);
    padding: 9px 10px;
    text-align: center;
}

th {
    background-color: var(--green-mid);
    color: white;
    font-weight: 600;
    position: relative;
    cursor: pointer;
    user-select: none;
}

td { background: #f9fbf9; }
td:nth-child(odd) { background: #f0f6f2; }

.food_name {
    text-align: left;
    font-weight: 600;
    color: var(--green-dark);
    cursor: pointer;
}

tbody tr:hover td { background: var(--row-hover) !important; }

th.tip { position: relative; }

.tip_definition {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--green-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 10pt;
    font-weight: 400;
    width: 190px;
    z-index: 200;
    line-height: 1.4;
}

.message_box {
    background: var(--card);
    padding: 16px 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--green-light);
}

.message_title {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 14pt;
    margin-bottom: 8px;
}

#message {
    font-size: 11pt;
    color: var(--text-muted);
    line-height: 1.6;
}

.viz_section {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.viz_section p {
    font-size: 11pt;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 14px;
}

.viz_image_box {
    text-align: center;
    margin-top: 12px;
}

.viz_img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.caption {
    font-size: 10pt;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

.interactive_ideas {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 20px;
    margin-top: 16px;
}

.interactive_ideas h4 {
    color: var(--green-dark);
    font-size: 11pt;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.interactive_ideas ul {
    list-style: none;
    padding: 0;
}

.interactive_ideas ul li {
    font-size: 10.5pt;
    color: var(--text);
    padding: 6px 0 6px 22px;
    position: relative;
    line-height: 1.55;
    border-bottom: 1px solid var(--border);
}

.interactive_ideas ul li:last-child { border-bottom: none; }

.interactive_ideas ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--green-mid);
    font-weight: 700;
}

.resources_intro {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 11pt;
    color: var(--text-muted);
    line-height: 1.7;
}

.resource_category {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.resource_category h2 {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 15pt;
    margin-bottom: 10px;
}

.resource_item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.resource_item:last-child { border-bottom: none; }

.resource_item a {
    font-weight: 600;
    color: var(--green-mid);
    font-size: 11.5pt;
    text-decoration: none;
}

.resource_item a:hover { text-decoration: underline; }

.resource_item p {
    font-size: 10.5pt;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.6;
}

.source_tag {
    display: inline-block;
    background: var(--green-pale);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 9pt;
    padding: 2px 7px;
    color: var(--green-dark);
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 600;
}

.usda_table_wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 14px;
}

.usda_table {
    border-collapse: collapse;
    width: 100%;
    font-size: 10pt;
}

.usda_table th {
    background-color: var(--green-mid);
    color: white;
    padding: 9px 12px;
    text-align: left;
}

.usda_table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    background: #f9fbf9;
}

.usda_table tr:nth-child(even) td { background: #f0f6f2; }

.usda_table td a {
    color: var(--green-mid);
    word-break: break-all;
    font-size: 9.5pt;
}

.footer { margin-top: 28px; }

.footer_web {
    background-color: var(--green-dark);
    text-align: center;
    font-size: 11pt;
    color: rgba(255,255,255,0.8);
    font-weight: 600;
    padding: 14px;
    border-radius: 0 0 8px 8px;
}

.footer_link {
    color: white;
    text-decoration: underline;
}

.page_title {
    font-family: 'DM Serif Display', serif;
    background-color: var(--green-dark);
    padding: 18px 24px;
    border-radius: 8px;
    font-size: 26pt;
    text-align: center;
    color: white;
    letter-spacing: 0.01em;
    margin-bottom: 0;
}

.data_section {
    background: var(--card);
    padding: 20px 24px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.data_section h2 {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 15pt;
    margin-bottom: 10px;
}

.data_section h3 {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 13pt;
    margin: 20px 0 10px;
}

.data_section img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.data_section p {
    font-size: 11pt;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 8px;
}

.chart_wrap {
    width: 100%;
    max-width: 700px;
    margin: 16px auto;
}

.cart_section {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 20px;
    margin-top: 16px;
    text-align: left;
}

.cart_section h2 {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 13pt;
    margin-bottom: 10px;
}

.cart_section select,
.cart_section button {
    font-family: 'DM Sans', sans-serif;
    font-size: 10.5pt;
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid var(--border);
    margin-right: 8px;
    cursor: pointer;
}

.cart_section button {
    background-color: var(--green-mid);
    color: white;
    border-color: var(--green-mid);
}

.cart_section button:hover { background-color: var(--green-dark); }

.remove-btn {
    background-color: #c0392b !important;
    border-color: #c0392b !important;
    font-size: 9pt !important;
    padding: 3px 8px !important;
}

.charts_row {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.source_logo {
    width: 220px;
    border-radius: 8px;
    margin: 10px auto;
    display: block;
}

.chart-wrap-tall {
    width: 100%;
    padding: 0 16px 24px;
    box-sizing: border-box;
}

.chart-card {
    max-width: 1320px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #b9ddbf;
    border-radius: 10px;
    padding: 26px 20px 18px;
    box-sizing: border-box;
}

.chart-card canvas {
    width: 100% !important;
    height: 720px !important;
}

.section-divider {
    border: none;
    border-top: 3px solid var(--green-light);
    margin: 36px 0 8px;
    border-radius: 2px;
}

.section-number {
    font-family: 'DM Serif Display', serif;
    color: var(--green-dark);
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}


body.game-page {
    --bg:        #e8f0eb;
    --shelf-bg:  #fff8f0;
    --shelf-wood:#cdc3b7;
    --panel-bg:  #fffdf7;
    --green:     #4a7c59;
    --green-lt:  #d4e8da;
    --amber:     #e8a838;
    --red:       #c0392b;
    --text:      #1a1208;
    --muted:     #7a6a55;
    --tag-bg:    #ece6da;
    --shadow:    0 4px 20px rgba(0,0,0,0.12);
}

body.game-page #container {
    background-color: transparent;
    min-height: auto;
    box-shadow: none;
    padding-bottom: 0;
}

body.game-page .app {
    display: grid;
    grid-template-columns: 35% 65%;
    min-height: 100vh;
}

body.game-page .cart-panel {
    background: var(--panel-bg);
    border-right: 1px solid #e0d9cc;
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

body.game-page .cart-panel h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
}

body.game-page .co2-box {
    background: var(--green-lt);
    border-radius: 14px;
    padding: 14px 16px;
    border: 1.5px solid #a8d4b8;
}
body.game-page .co2-box .label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green);
}
body.game-page .co2-box .value {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    color: var(--green);
    line-height: 1.1;
}
body.game-page .co2-box .unit { font-size: 0.85rem; color: var(--muted); }

body.game-page .budget-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--muted);
    margin-bottom: 5px;
}
body.game-page .budget-bar-wrap {
    background: #e8e0d0;
    border-radius: 99px;
    height: 10px;
    overflow: hidden;
}
body.game-page .budget-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--green);
    transition: width 0.5s ease, background 0.4s;
    width: 0%;
}
body.game-page .budget-bar.warn { background: var(--amber); }
body.game-page .budget-bar.over { background: var(--red); }
body.game-page .budget-note { font-size: 0.68rem; color: var(--muted); margin-top: 4px; }

body.game-page .section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

body.game-page .nutrition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
body.game-page .nut-card {
    background: var(--tag-bg);
    border-radius: 10px;
    padding: 8px 12px;
}
body.game-page .nut-card .nt { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
body.game-page .nut-card .nv { font-size: 1rem; font-weight: 500; }

body.game-page .cart-graphic-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

body.game-page .cart-svg-container {
    position: relative;
    width: 100%;
    max-width: 360px;
}
body.game-page .cart-svg-container svg {
    width: 100%;
    height: auto;
    display: block;
}

body.game-page .cart-items-inside {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 60%;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding: 4px 4px 0;
    pointer-events: none;
    overflow: hidden;
}

body.game-page .cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    padding: 2px;
    animation: dropIn 0.25s ease;
    flex-shrink: 0;
}
@keyframes dropIn {
    from { transform: translateY(-18px) scale(0.7); opacity: 0; }
    to   { transform: translateY(0)     scale(1);   opacity: 1; }
}

body.game-page .cart-drop-zone {
    position: absolute;
    top: 8%;
    left: 8%;
    width: 84%;
    height: 62%;
    border-radius: 10px;
    border: 2.5px dashed transparent;
    transition: border-color 0.2s, background 0.2s;
}
body.game-page .cart-drop-zone.drag-over {
    border-color: var(--green);
    background: rgba(74,124,89,0.10);
}

body.game-page .empty-cart-msg {
    text-align: center;
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 6px;
}

body.game-page .cart-list {
    width: 100%;
    min-height: 40px;
    max-height: 130px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

body.game-page .cart-chip {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.78rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    animation: popIn 0.2s ease;
}
@keyframes popIn {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
body.game-page .cart-chip .cc-name { flex: 1; font-weight: 500; }
body.game-page .cart-chip .cc-co2  { color: var(--green); font-size: 0.72rem; margin-left: 6px; }
body.game-page .cart-chip .cc-del  {
    background: none; border: none; cursor: pointer;
    color: #ccc; font-size: 0.9rem; margin-left: 6px;
    transition: color 0.15s;
}
body.game-page .cart-chip .cc-del:hover { color: var(--red); }

body.game-page .clear-btn {
    background: #fff;
    border: 1.5px solid #e0d5c5;
    border-radius: 8px;
    padding: 7px;
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--muted);
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
}
body.game-page .clear-btn:hover { border-color: var(--red); color: var(--red); }

body.game-page .store-panel {
    padding: 24px 28px;
    overflow-y: auto;
}

body.game-page .loading-msg {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 0.9rem;
}
body.game-page .loading-msg .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0d9cc;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

body.game-page .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}
body.game-page .filter-bar .fb-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-right: 4px;
}
body.game-page .filter-btn {
    background: #fff;
    border: 1.5px solid #ddd6c9;
    border-radius: 99px;
    padding: 5px 14px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: var(--text);
}
body.game-page .filter-btn:hover  { border-color: var(--green); color: var(--green); }
body.game-page .filter-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

body.game-page .sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}
body.game-page .sort-bar label { font-size: 0.78rem; color: var(--muted); }
body.game-page .sort-bar select {
    font-family: inherit;
    font-size: 0.82rem;
    border: 1.5px solid #ddd6c9;
    border-radius: 8px;
    padding: 5px 10px;
    background: #fff;
    cursor: pointer;
}

body.game-page .shelf {
    background: var(--shelf-bg);
    border-radius: 14px;
    margin-bottom: 22px;
    padding: 22px 22px 0;
    box-shadow: var(--shadow);
}
body.game-page .shelf::after {
    content: '';
    display: block;
    height: 16px;
    background: var(--shelf-wood);
    border-radius: 0 0 14px 14px;
    margin: 0 -22px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.35);
}

body.game-page .shelf-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding-bottom: 14px;
}

body.game-page .food-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    user-select: none;
    transition: transform 0.15s;
}
body.game-page .food-card:hover  { transform: translateY(-8px) scale(1.05); }
body.game-page .food-card:active { cursor: grabbing; transform: scale(0.95); }

body.game-page .food-img-wrap {
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255,255,255,0.12);
    overflow: hidden;
}
body.game-page .food-img-wrap img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    pointer-events: none;
}

body.game-page .food-label {
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #555045;
    text-align: center;
    line-height: 1.2;
}
body.game-page .food-co2-tag {
    margin-top: 3px;
    font-size: 0.68rem;
}

body.game-page .food-card.dragging { opacity: 0.35; }