:root{
  --bg: #0b0f14;
  --surface: #101622;
  --card: #121a28;
  --muted: #9fb0c0;
  --text: #e8eef6;
  --brand: #6ad1ff;
  --brand-2: #8cffb7;
  --border: rgba(255,255,255,0.08);
  --ring: rgba(106, 209, 255, 0.35);
}

*{ box-sizing: border-box; }

html {
  font-size: 90%;
  height: 100%;
}

body{
  margin:0; padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* Layout */
.container{
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.main{
  padding: 0 0 16px;
  flex-grow: 1;
}

/* Header */
.site-header{
  position: sticky; top:0; z-index: 20;
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,22,34,0.9), rgba(16,22,34,0.6));
}

.header-inner{
  display:flex; align-items:center; justify-content:space-between;
  height:64px;
}

.brand{
  font-weight: 700; font-size: 18px; letter-spacing: .2px; text-decoration:none;
  color: var(--text);
}

.site-nav ul{ display:flex; gap: 18px; list-style:none; margin:0; padding:0; }
.site-nav a{
  color: var(--muted); text-decoration:none; font-weight: 500; padding: 8px 10px; border-radius: 8px;
}
.site-nav li.active a, .site-nav a:hover{
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

/* Hero */
.hero{
  padding: 40px 0 12px;
}
.hero-inner{
  text-align: left;
  max-width: 860px;
}
.hero-title{
  font-size: clamp(28px, 2.8vw, 42px);
  line-height: 1.1;
  margin: 0 0 8px;
}
.hero-sub{
  color: var(--muted);
  max-width: 720px;
  margin: 0 0 18px;
}
.hero-cta{ display:flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn{
  display:inline-block; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--text); text-decoration:none; font-weight:600; transition: transform .04s ease, box-shadow .2s ease, background .2s;
  background: rgba(255,255,255,0.03);
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 18px -12px var(--ring); }
.btn:active{ transform: translateY(0); }

.btn-primary{
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #08131a; border-color: transparent;
}
.btn-soft{
  background: rgba(255,255,255,0.05);
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--muted);
}
.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.breadcrumbs a:hover {
  color: var(--text);
}
.breadcrumbs span {
  color: var(--text);
}
.breadcrumbs .sep {
  margin: 0 8px;
  color: #444;
}

/* Sections / Cards */
.section-head{
  display:flex; align-items:baseline; justify-content:space-between; gap: 16px;
  margin: 18px 0 10px;
}
.section-head h1, .section-head h2{ margin:0; }

.section-head .link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.section-head .link:hover {
  color: var(--brand);
}

.muted{ color: var(--muted); }

.cards-section{
  margin-top: 48px;
  padding: 24px;
  border-radius: 14px;
  background: radial-gradient(circle at top, rgba(106, 209, 255, 0.03), transparent 50%);
}

.cards{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card-hover{ transition: transform .08s ease, box-shadow .25s ease, border-color .2s; }
.card-hover:hover{
  transform: translateY(-2px);
  border-color: rgba(138, 230, 255, 0.35);
  box-shadow: 0 14px 28px -20px var(--ring);
}

.card h3{ margin: 0 0 6px; font-size: 18px; }
.card p{ margin: 0 0 12px; color: var(--muted); }

/* Game Cards */
.card-game {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 180px;
  padding: 12px;
  text-decoration: none;
  background-size: cover;
  background-position: center;
  position: relative;
}
.card-game::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent 60%);
  opacity: 0.8;
  transition: opacity .2s;
}
.card-game:hover::after {
  opacity: 1;
}
.card-game h3 {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 20px;
}

/* Prose block for Wagtail rich text */
.prose .card{
  padding: 20px 22px;
}
.prose h2, .prose h3{ margin-top: 18px; }
.prose p{ color: var(--text); }

.tip-jar {
  margin-top: 48px;
  padding: 24px;
  border-radius: 14px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(140, 255, 183, 0.04), transparent 60%);
}
.tip-jar h3 {
  margin-top: 0;
  font-size: 1.5rem;
}
.tip-jar p {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
}
.tip-jar .tip-actions {
  margin-top: 16px;
}

/* Two-column layout for simulator pages */
.two-col{
  display:grid; grid-template-columns: 1.1fr 2fr; gap: 18px; align-items:start;
}
.two-col > aside.panel {
  position: sticky;
  top: 20px;
}
.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
}

/* Log container */
.term {
  height: 80vh;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.log-group {
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #161b22;
}
.log-group-summary {
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1.5;
  border-radius: 7px;
  display: block; /* Allow content to flow next to marker */
}
.log-group[open] > .log-group-summary {
  border-bottom: 1px solid #2a2f3a;
  border-radius: 7px 7px 0 0;
}
.summary-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.summary-header time { font-size: 0.75em; color: var(--muted); white-space: nowrap; }
.params-container { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.log-group-summary .param {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8em;
}
.log-group-summary .param .label {
  color: var(--muted);
}
.log-group-summary .param .value {
  font-weight: 500;
}
.param.param-seed {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.75em;
  background: rgba(255,255,255,0.03);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}
.param.param-seed .value {
  color: #99a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seeds-info {
  margin-top: 8px;
  font-size: 0.8em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-all;
}
.seed-item { display: flex; gap: 8px; color: var(--muted); }
.seed-item .label { flex-shrink: 0; }
.seed-item .value { color: #889; }

.log-group-content {
  padding: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.log-entry {
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  word-break: break-word;
  line-height: 1.4;
  box-shadow: none;
}
.log-entry::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.log-entry.win { 
  background: rgba(14, 203, 129, 0.1); 
  color: #aafffa; 
}
.log-entry.win::before {
  background-color: #0ecb81;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
}

.log-entry.loss { 
  background: rgba(246, 70, 93, 0.08); 
  color: #ffa8b9; 
}
.log-entry.loss::before {
  background-color: #f6465d;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") no-repeat center;
}

.log-entry.summary { 
  background: rgba(240, 185, 11, 0.1); 
  color: #f0b90b; 
}
.log-entry.summary::before {
  background-color: #f0b90b;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") no-repeat center;
}

.log-entry.info::before {
  background-color: #aab4c3;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E") no-repeat center;
}

.log-entry.error { 
  background: rgba(246, 70, 93, 0.15); 
  color: #f6465d; 
}
.log-entry.error::before {
  background-color: #f6465d;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E") no-repeat center;
}

.log-entry.done { text-align: center; color: #666; background: transparent; border: 0; display: block; box-shadow: none; }
.log-entry .parts-container { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.log-entry .label { color: var(--muted); font-size: 0.9em; }
.parts-container .label {
    border: solid 1px rgba(255, 255, 255, .15);
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}
.log-entry .value { color: var(--text); font-weight: 500; }
.log-entry.win .value { color: #0ecb81; }
.log-entry.loss .value { color: #f6465d; }

.log-entry-hidden-counter {
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
  padding: 4px;
}

#log-placeholder {
  text-align: center;
  color: var(--muted);
  height: 100%;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.1rem;
}

/* Footer */
.site-footer{
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,22,34,0.6), rgba(16,22,34,0.95));
  color: var(--muted);
}
.footer-inner{ padding: 18px 0; }
.footer-inner a{ color: var(--text); text-decoration: none; }

/* Responsive */
@media (max-width: 900px){
  .two-col{ grid-template-columns: 1fr; }
  .header-inner{ height: 60px; }
}
  color: var(--muted);
}
.footer-inner{ padding: 18px 0; }
.footer-inner a{ color: var(--text); text-decoration: none; }

/* Responsive */
@media (max-width: 900px){
  .two-col{ grid-template-columns: 1fr; }
  .header-inner{ height: 60px; }
}
