  :root{
    --bg:#1a1a1a; --bezel:#2a2a2a; --bezel-edge:#0e0e0e; --paper:#f7f3e8; --ink:#222;
    --shadow:0 10px 30px rgba(0,0,0,.5); --radius:22px;
    --chip:#0f0f0f; --chip-b:#333; --ok:#86ff5a; --fs-ctrl:16px;
  }
  html,body{height:100%}
  *{box-sizing:border-box}
  body{
    margin:0; font:16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial;
    color:#eee; background:radial-gradient(60% 100% at 50% 0%,#222 0%, #111 60%, #0b0b0b 100%);
  }
  .app{max-width:1040px;margin-inline:auto;padding:12px}
  button,[role="button"],.chip,select,input[type="date"]{touch-action:manipulation}
  :focus-visible{outline:2px solid var(--accent,#6cf);outline-offset:2px;border-radius:8px}
  .wrap{max-width:980px; margin:0 auto; padding:40px 16px; min-height:100vh; display:flex; flex-direction:column}
  .device{border:2px solid var(--bezel-edge); border-radius:24px; background:linear-gradient(180deg,var(--bezel),#1f1f1f);
    box-shadow:var(--shadow); overflow:hidden; position:relative; display:flex; flex-direction:column; flex:1}
  header{display:flex; gap:12px; align-items:center; padding:14px 16px; border-bottom:1px solid #000;
    background:linear-gradient(180deg,#2c2c2c,#202020); position:sticky; top:0; z-index:10}
  .led{width:10px; height:10px; border-radius:50%; background:#3a3a3a; box-shadow:0 0 0 1px #000 inset, 0 0 8px #000}
  .led.on{background:var(--ok); box-shadow:0 0 0 1px #000 inset, 0 0 10px var(--ok)}
  .badge{margin-left:auto; font-size:12px; padding:2px 8px; border:1px solid #444; border-radius:999px; opacity:.85}
  .panel{display:grid; grid-template-columns:1fr; gap:16px; padding:16px; flex:1; overflow-y:auto}
  .sidebar{display:none}
  .layout{grid-template-columns:1fr}
  .controls{
    border:1px solid rgba(255,255,255,.1); background:rgba(255,255,255,.03); border-radius:16px; padding:16px;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.02);
    display:flex;
    flex-direction:column;
    gap:.75rem;
    margin-bottom:1rem;
  }
  .controls select,.controls button,.controls input{font-size:var(--fs-ctrl)}
  .control-row{display:flex; align-items:center; gap:.5rem}
  .control{flex:1; display:flex; flex-direction:column; gap:.25rem}
  .control__label{font-size:.85rem; opacity:.85}
  .control__input,
  .control__select{appearance:none; width:100%; background:#0f0f0f; color:#fff; border:1px solid #333; border-radius:10px; padding:10px}
  .chip{padding:8px 10px; border-radius:10px; border:1px solid #333; background:#111; color:#ddd; cursor:pointer; user-select:none}
  .chip--ghost{background:transparent}
  .chip.active{border-color:#aaf08a; background:#183219; color:#eaffea; box-shadow:inset 0 0 0 1px rgba(134,255,90,.2)}
  .chip.chip--icon{
    display:inline-flex;
    align-items:center;
    gap:.45rem;
    line-height:1;
  }
  .chip.chip--icon svg{
    display:block;
    color:#e5e7eb; /* text-slate-200-ish */
    opacity:.95;
  }
  .chip[data-kind="zodiac"] svg{color:#a5b4fc}
  .chip[data-kind="element"] svg{color:#fbc19d}
  .screen{border:1px solid #000; border-radius:16px; padding:12px; background:radial-gradient(120% 140% at 50% 10%, #121212 0%, #0a0a0a 40%, #050505 100%);
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.03)}
  .section{border:1px solid rgba(255,255,255,.1); background:rgba(255,255,255,.03); border-radius:16px; padding:12px 14px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.02)}
  .section h4{margin:0 0 8px; font-size:13px; letter-spacing:.08em; text-transform:uppercase; color:#c9c9c9}
  .pill{display:inline-block; padding:4px 8px; border-radius:999px; border:1px solid rgba(255,255,255,.15); background:rgba(0,0,0,.12); font-size:13px; margin:2px; color:#eee}
  .next-days{display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:10px}
  .card{padding:8px; border-radius:12px; text-align:center; border:1px solid; }
  .c-fruit{background:rgba(255,145,0,.12); color:#ffd6a6; border-color:#ff9100}
  .c-root{background:rgba(255,193,7,.12); color:#ffe8a6; border-color:#ffc107}
  .c-leaf{background:rgba(16,185,129,.12); color:#bff7db; border-color:#10b981}
  .c-flower{background:rgba(79,70,229,.14); color:#d3d0ff; border-color:#4f46e5}
  .hidden{display:none}
  .lunar-meta { display: flex; align-items: center; gap: .5rem; }
  .moon-icon svg { display: block; }

  @media (max-width: 480px) {
    .next-days { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .next-day:nth-child(n+5) { display: none; }
  }

  /* Remove leftover gap reserved for the old label */
  #lunar-summary .moon-label { display: none !important; }

  /* Ensure the moon icon sits nicely among other pills */
  #lunar-summary .moon-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 28px; /* matches chip height */
  }
  #lunar-summary .moon-icon svg {
    height: 100%;
    width: auto;
  }

  /* Indicate tooltip availability */
  #lunar-summary .moon-icon[title] { cursor: help; }
  #lunar-summary { position: relative; }
  #lunar-summary .dev-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size:10px;
    padding:2px 4px;
    border-radius:4px;
    pointer-events:none;
  }
  .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .note{border:1px solid rgba(255,255,255,.1); border-radius:12px; background:rgba(255,255,255,.06); padding:10px; font-size:14px; color:#e9e9e9}
  footer{margin-top:auto; display:flex; justify-content:center; align-items:center; padding:10px 14px; border-top:1px solid #000;
    background:linear-gradient(180deg,#2c2c2c,#202020); font-size:12px; color:#c9c9c9}
  .badgeDay{display:inline-flex; gap:8px; align-items:center; padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.2)}
  .dot{width:8px;height:8px;border-radius:50%;}
  .fruit .dot{background:#ffb255}
  .root .dot{background:#ffd36a}
  .leaf .dot{background:#5ee1a0}
  .flower .dot{background:#aca6ff}
  .filters{display:flex; flex-wrap:wrap; gap:8px}
  .filters label{display:flex; align-items:center; gap:4px; font-size:13px}
  .constraint{font-size:12px; color:#f99}


  /* --- Crop chips --- */
  .cropsGrid{display:flex;flex-wrap:wrap;gap:8px}
  .muted{color:#ccc;opacity:.85}
  .noCropsMsg{flex-basis:100%}
  .cropChip{
    display:flex;flex-direction:column;gap:4px;
    padding:8px 10px;border-radius:12px;border:1px solid rgba(255,255,255,.15);
    background:rgba(255,255,255,.05);color:#eee;font-size:14px
  }
  .cropChip .name{font-weight:600;letter-spacing:.01em}
  .cropChip .sub{font-size:12px;opacity:.85}
  .cropChip .badges{display:flex;gap:6px;flex-wrap:wrap}
  .cropChip .badgeMini{
    font-size:11px;padding:2px 6px;border-radius:999px;
    border:1px solid rgba(255,255,255,.2);background:rgba(0,0,0,.15)
  }
  .cropChip .constraint{font-size:11px;color:#f6b;opacity:.95}

  /* subtle tints by biodynamic type */
  .cropChip.fruit{  background:rgba(255,145,0,.08); border-color:#ff9100 }
  .cropChip.root{   background:rgba(255,193,7,.08); border-color:#ffc107 }
  .cropChip.leaf{   background:rgba(16,185,129,.08); border-color:#10b981 }
  .cropChip.flower{ background:rgba(79,70,229,.10); border-color:#4f46e5 }

  /* “+N more” pill */
  .morePill{
    align-self:flex-start;padding:8px 12px;border-radius:999px;
    border:1px dashed rgba(255,255,255,.25);background:transparent;color:#ddd;font-size:13px
  }

  /* group heading for other day types */
  .typeGroup{margin-bottom:12px}
  .typeGroup h5{margin:0 0 6px;font-size:12px;letter-spacing:.08em;text-transform:capitalize;color:#c9c9c9}

  /* Optional: two-column flow on wide screens */
  @media (min-width:980px){
    #best.cropsGrid{column-count:2;column-gap:12px}
    #best .cropChip{break-inside:avoid;width:100%}
  }

/* Make preview tiles clearly clickable */
#ribbon [data-goto] {
  cursor: pointer;
}

/* Highlight the currently selected date tile */
#ribbon [data-goto].is-active {
  outline: 2px solid var(--brand-400, #4a6ed1);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400, #4a6ed1) 25%, transparent);
}
/* Layout wrapper for the top controls */
.controls {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Control group */
.control {
  display: grid;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.control__label {
  font-size: 0.75rem;
  letter-spacing: .03em;
  opacity: .8;
}

/* Inputs & selects look like small cards */
.control__input,
.control__select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--surface-3, #1f2732);
  background: var(--surface-2, #0f141b);
  color: var(--text, #dbe7ff);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
}

.control__input:hover,
.control__select:hover {
  border-color: var(--brand-300, #35518f);
}

.control__input:focus,
.control__select:focus {
  border-color: var(--brand-400, #4a6ed1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400, #4a6ed1) 25%, transparent);
}

/* Native select caret tweak for dark UI */
.control__select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

/* Today chip matches your pill buttons */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  letter-spacing: .02em;
  border: 1px solid var(--surface-4, #273041);
  background: var(--surface-2, #0f141b);
  color: var(--text, #dbe7ff);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, transform .06s;
}
.chip:hover { border-color: var(--brand-300, #35518f); }
.chip:active { transform: translateY(1px); }
.chip--ghost { opacity: .9; }
.chip--static {
  cursor: default;
}
.chip--static:hover {
  border-color: var(--surface-4, #273041);
}
.chip--static:active {
  transform: none;
}

/* Prev/Next day buttons */
.control-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--surface-3, #1f2732);
  background: var(--surface-2, #0f141b);
  color: var(--text, #dbe7ff);
  cursor: pointer;
  transition: border-color .15s, transform .06s;
}
.control-btn:hover { border-color: var(--brand-300, #35518f); }
.control-btn:active { transform: translateY(1px); }

/* Date input + Today button container */
.date-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
}

@media (max-width: 480px) {
  .date-controls {
    flex-direction: column;
    align-items: center;
  }

  .date-controls button {
    width: auto;
  }
}
@media (max-width:768px){
  .controls{display:flex;flex-direction:column;gap:10px}
  [data-row="date"]{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px}
  select, input, button, .chip{min-height:44px;font-size:16px}
  .panel{padding:12px;border-radius:12px;flex:initial;overflow:visible}
  .device{overflow:visible;flex:initial}
  .scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch}
  body{padding-bottom:max(env(safe-area-inset-bottom),12px)}
}

