:root{
  --bg:#0b0b0f; --card:#3a0d0d; --fg:#f5f7fb; --muted:#aab0bd;
  --festival:#16a34a; /* green */
  --waning:#2563eb;   /* blue  */
  --waxing:#dc2626;   /* red   */
  --sahaj:#facc15;    /* golden yellow */
  --country:#c084fc;   /* violet for local events */
  --acc:#7dd3fc;
}

html,body{
  height:100%;
  margin:0;
  min-height: 100dvh;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  color:var(--fg);
}
body { position: relative; background: var(--bg); }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: var(--pattern-url);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.wrap{max-width:1000px;margin:0 auto;padding:24px;position:relative;z-index:1}
header{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between}
h1{margin:0;font-weight:800;font-size:clamp(20px,3vw,28px);color:#3a0d0d}
.muted{color:var(--muted)}
.card{background:var(--card);border:1px solid #2a2f3a;border-radius:14px;padding:16px}
.row{display:flex;gap:12px;flex-wrap:wrap}
button,input[type=file],label.select{background:#3a0d0d;border:1px solid #2a2f3a;border-radius:10px;color:var(--fg);padding:10px 12px;cursor:pointer}
button:hover,.select:hover{border-color:#3b4254}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:14px;color:var(--fg)}
.dot{display:inline-block;width:10px;height:10px;border-radius:999px;margin-right:6px;vertical-align:middle}

.festival{color:var(--festival)}
.waning{color:var(--waning)}
.waxing{color:var(--waxing)}
.sahaj{color:var(--sahaj)}
.country{color:var(--country)}
.recurring{opacity:.95}

ul,ol{margin:8px 0 0 18px;padding:0}
li{margin:6px 0}

.empty{opacity:.7}
.next{font-weight:700}

.controls{
  display:flex;
  align-items:flex-start;
  gap:8px;
  flex-wrap:nowrap;        /* keep them on one line */
  overflow-x:auto;         /* allow scroll if too tight */
  padding-bottom:4px;      /* avoid clipping shadows/outline */
}
.controls::-webkit-scrollbar{ height:6px; } /* optional */

.footer {margin-top:18px;font-size:13px;text-align: center}
.footer em {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(11,11,15,0.35);
}
.footer a {
  color: #3a0d0d;
  text-decoration: underline;
}
.footer a:hover { text-decoration: none; opacity: 0.8; }

.grid{display:grid;grid-template-columns:1fr;gap:16px}
@media (min-width:800px){ .grid{grid-template-columns:1fr 1fr} }
.pill{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;border:1px solid #2a2f3a}
.info-link {font-size: 0.9em;margin-left: 6px;opacity: 0.7;text-decoration: none;}
.info-link:hover {opacity: 1;text-decoration: underline;}

/* unified size for arrows and Today button */
.caret{
  min-width:42px;
  padding:8px 12px;
  font-weight:700;
  height:38px;              /* ensures same height as flag dropdown */
  display:flex;
  align-items:center;
  justify-content:center;
}
.caret.small{ /* keep small variant available for other minor buttons if needed */
  min-width:42px;
  padding:8px 12px;
  font-weight:700;
  opacity:1;                /* no dimming */
}

.hidden{display:none !important}

.modal{
  position:fixed; inset:0; display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.6); z-index:50; padding:16px;
}
.modal-card{
  background:var(--card); border:1px solid #2a2f3a; border-radius:14px;
  max-width:720px; width:min(92%,720px); padding:16px 18px;
  box-shadow:0 10px 40px rgba(0,0,0,0.5);
}
.modal-card a{ color:var(--acc); }

/* Clickable items */
a.evt{ color:inherit; text-decoration:none; cursor:pointer; }
a.evt:hover{ text-decoration:underline; }

/* Language dropdown */
.lang-switch{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.lang-dropdown{ position:relative; }
.lang-toggle{
  height:38px;
  display:flex;
  align-items:center;
}
.lang-toggle:hover{ border-color:#3b4254; }
.lang-toggle .chev{ width:14px; height:14px; opacity:.8; transition:transform .15s ease; }
.lang-dropdown[aria-expanded="true"] .chev{ transform:rotate(180deg); }
.lang-menu{
  position:static;          /* participate in normal flow */
  margin-top:6px;
  min-width:180px;
  background:var(--card);
  border:1px solid #2a2f3a;
  border-radius:10px;
  padding:6px;
  list-style:none;
  display:none;             /* hidden by default */
  box-shadow:0 10px 30px rgba(0,0,0,0.35);
  width: max-content;       /* size to its content */
}
/* Show menu when expanded; this now increases header height */
.lang-dropdown[aria-expanded="true"] .lang-menu{ display:block; }
.lang-menu li{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:8px; cursor:pointer; outline:0;
}
.lang-menu li:hover, .lang-menu li:focus{ background:rgba(255,255,255,0.06); }
.lang-menu li[aria-selected="true"]{ background:rgba(125,211,252,0.15); }
.lang-name{ font-size:14px; }
/* Optional: tighter on small screens */
@media (max-width:480px){
  .lang-menu{ min-width:150px; }
}

/* thin separator line above every legend */
section .legend {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 10px;
  padding-top: 6px;
}

/* Settings modal tweaks */
.settings-body {
  display: grid;
  gap: 10px;
  margin: 10px 0 16px;
}
.chk {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
}
.settings-actions {
  display:flex;
  gap:8px;
  justify-content:flex-end;
}

/* Today extras block (links under Today list) */
.today-extras {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.today-extras a {
  text-decoration: underline;
}
