/* ===== Theme Variables ===== */
:root {
  --bg: #fff8ee;
  --card: #ffffff;
  --ink: #2e2a25;
  --muted: #7a6a57;
  --brand: #ffcc66;
  --brand-ink: #6b4e16;
  --warn: #d93025;
  --ok: #1b8b3d;
  --accent: #8758ff;
  --soft: #f4ecda;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.08);

  /* Fonts */
  --font-ui: "Noto Sans Myanmar", system-ui, -apple-system, Segoe UI, Roboto,
    Ubuntu, Cantarell, sans-serif;
  --font-fancy: "Times New Roman", Georgia, "Noto Serif Myanmar", serif;
}

* {
  box-sizing: border-box;
}
/* html,
body {
  height: 100%;
} */
body {
  margin: 0;
  font-family: var(--font-ui);
  background: linear-gradient(135deg, #fffaf1 0%, #f7e7c3 100%);
  color: var(--ink);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom: 2px solid #e6b54a;
  position: sticky;
  top: 0;
  z-index: 99;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .logo {
  font-size: 28px;
}
.brand h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.brand small {
  padding: 7px 0;
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  opacity: 0.85;
}
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.select {
  appearance: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2c26e;
  background: #fffaf0;
  color: #553d12;
  font-weight: 600;
}
.btn {
  border: none;
  background: #fff;
  color: #4b3d1b;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-weight: 700;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  border: 1px dashed #6e5827;
}
.btn.wide {
  width: 100%;
}

.poem {
  max-width: 1100px;
  margin: 12px auto 0;
  padding: 18px 20px;
  text-align: center;
  /* background: var(--card); */
  border-radius: 18px;
  box-shadow: var(--shadow);
  border-left: 6px solid #e9c058;
  border-right: 6px solid #e9c058;
}
.poem-line {
  font-family: var(--font-fancy);
  font-size: 1.15rem;
}
.poem-meta {
  margin-top: 6px;
  color: var(--muted);
  font-style: italic;
}

.wrap {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  padding: 16px;
  max-width: 1300px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.legend h3,
.details h3 {
  margin: 0 0 10px;
}
.legend ul {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 0;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.badge.fullmoon {
  background: #222;
  color: #ffd900;
}
.badge.newmoon {
  background: #222;
  color: #222;
  outline: 3px solid #ddd;
}
.badge.waxing {
  background: #ffcc66;
}
.badge.waning {
  background: #b8e0ff;
}
.badge.holiday {
  background: #ffe2df;
}
.badge.fest {
  background: #fff0b3;
}
.badge.note {
  background: #e3f3ff;
}

.hint {
  margin-top: 10px;
}
.hint summary {
  cursor: pointer;
}

/* placeholder text color for title input */
.custom-add input#custTitle::placeholder {
  color: #fdfdfc; /* သင်လိုချင်တဲ့ အရောင်သတ်မှတ်ပါ */
  opacity: 1;     /* iPhone/Safari မှာ မပျော့အောင် */
}

/* Dark mode အတွက် optional */
:root[data-theme="dark"] .custom-add input#custTitle::placeholder {
  color: #ffd580;
}

.custom-add {
  margin-top: 14px;
  border-top: 1px dashed #ead7a2;
  padding-top: 12px;
}
.custom-add label {
  display: block;
  font-size: 0.9rem;
  margin: 8px 0;
}
.custom-add input,
.custom-add select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #ead7a2;
  /* background: #c2c1bc; */
}

.calendar .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.calendar .grid.head {
  font-weight: 700;
  color: #6b4e16;
  margin-bottom: 8px;
}
.calendar .grid.head .wknd {
  color: #9a3b00;
}

.day {
  background: var(--soft);
  border-radius: 14px;
  padding: 10px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: 0.15s ease-in-out;
  border: 1px solid #efe3c7;
}
.day:hover {
  transform: translateY(-2px);
  background: #fffbe8;
}
.day .nums {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.day .nums .greg {
  font-weight: 800;
}
.day .nums .myan {
  font-size: 0.9rem;
  color: var(--muted);
}
.day .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}
.tag {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #ead7a2;
}
.tag.warn {
  border-color: #f5b5ae;
  background: #fff2f1;
  color: #b31b12;
}
.tag.fest {
  border-color: #f2d77a;
  background: #fff8d3;
  color: #856100;
}
.tag.moon {
  border-color: #c7c7f5;
  background: #f5f6ff;
  color: #3432a8;
}
.tag.note {
  border-color: #b6e0ff;
  background: #eef7ff;
  color: #155fa0;
}
.day.today {
  outline: 2px solid #7c5a1a;
  box-shadow: 0 0 0 3px #ffe7a6 inset;
}

.details p {
  margin: 0.4rem 0;
}
.details .title {
  font-weight: 800;
  font-size: 1.1rem;
}
.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px;
  margin: 8px 0;
}
.kv .k {
  color: #6c5731;
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.notes {
  margin-top: 14px;
}
.notes textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #ead7a2;
  padding: 10px;
  background: #fffdf6;
}
.note-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.foot {
  text-align: center;
  padding: 14px;
  color: #6d5831;
  opacity: 0.9;
}

/* ===== Dark ===== */
.dark {
  --bg: #0f0d0b;
  --card: #16120f;
  --ink: #efe9e1;
  --muted: #b6a996;
  --brand: #2a2011;
  --brand-ink: #f6e3b3;
  --warn: #ff7d6b;
  --ok: #6edb8a;
  --accent: #b49bff;
  --soft: #1b1713;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  background: #0f0d0b;
  color: var(--ink);
}
.dark .topbar {
  background: var(--brand);
  color: var(--brand-ink);
  border-bottom-color: #493b20;
}
.dark .select {
  background: #1b1713;
  border-color: #3b2f1c;
  color: var(--ink);
}
.dark .btn {
  background: #211a14;
  color: #f4e8d3;
  border: 1px solid #3b2f1c;
}
.dark .btn.ghost {
  background: transparent;
  border: 1px dashed #3b2f1c;
}
.dark .todaybar {
  background: #1d1711;
  color: #f0e5d1;
  border-bottom-color: #3b2f1c;
}
.dark .day {
  background: #6b4e16;
  /* border-color: #2b241b; */
}
.dark .day:hover {
  background: #201a14;
}
.dark .tag {
  background: #15110e;
  border-color: #3b2f1c;
}

/* ===== Font Toggle (serif) ===== */
.serif body,
.serif .poem-line {
  font-family: var(--font-fancy);
}

/* Uniform day cell height to avoid bouncy grids across months */
.day {
  border: 1px solid #5c5545;
  height: 132px;
  min-height: 132px;
}
.day.pad {
  visibility: hidden;
} /* keep space but invisible */
/* tap-to-expand on mobile */
.day .tags {
  max-height: 72px;
  overflow: hidden;
}
.day.expand .tags {
  max-height: 160px;
  overflow: auto;
}

.poem {
  display: block;
  font-style: italic;
  background: #e7e7dd;
  color: var(--text-muted, #0e9d91);
  margin-top: 6px;
  line-height: 1.5;
  white-space: pre-line;
}

.chip.stone {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  padding: 4px 8px;
  margin-left: 6px;
  border-radius: 12px;
  background: var(--chip-bg, rgba(0, 0, 0, 0.06));
  vertical-align: middle;
  white-space: nowrap;
}
body.dark .chip.stone {
  background: rgba(255, 255, 255, 0.12);
}

:root {
  --theme-color: #ffcf33;
}

body {
  transition: background 0.8s ease, color 0.4s ease;
}

.todaybar {
  text-align: center;
  padding: 10px 16px;
  color: #563f1b;
  background: #ffeab3;
  border-bottom: 1px solid #f3d07c;
}
#todayBar {
  font-weight: bold;
  text-align: center;
  padding: 0.7rem;
  border-radius: 10px;
  margin: 10px auto;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #111;
  transition: background 0.8s ease, color 0.4s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
  body {
    background: #111;
    /* color: #eee; */
  }
}

.theme-dropdown {
  margin: 8px auto;
  display: block;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

/* Topbar responsive */
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar .brand h1 {
  padding: 7px 0;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* avoid overflow on iPhone */
}
.topbar .controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap; /* buttons/selects wrap as needed */
}

/* Birthstone chip look */
.chip.stone {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  padding: 4px 8px;
  margin-left: 6px;
  border-radius: 12px;
  background: var(--chip-bg, rgba(0, 0, 0, 0.06));
  vertical-align: middle;
  white-space: nowrap;
}
.chip.stone .mm {
  opacity: 0.85;
}
body.dark .chip.stone {
  background: rgba(255, 255, 255, 0.12);
}

/* Small iPhones */
@media (max-width: 420px) {
  .topbar {
    gap: 8px;
  }
  .topbar .controls {
    gap: 4px;
  }
  #todayBar {
    font-size: 14px;
  }
  .chip.stone {
    font-size: 0.85rem;
  }
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .brand h1 {
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.select,
.btn {
  font-size: 14px;
  padding: 4px 6px;
}

#themeSelect {
  border-radius: 6px;
  padding: 4px;
  font-size: 14px;
}

@media (max-width: 480px) {
  .controls {
    justify-content: center;
    width: 100%;
  }
  .brand h1 {
    font-size: 15px;
  }
}

.greg-abbr {
  font-weight: 600;
  letter-spacing: 0.2px;
}
.nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.nums .myan {
  font-size: 12px;
  opacity: 0.8;
}

.nums.two-lines{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.nums .mm-month{
  font-weight:600;
  font-size:14px;
}
.nums .en-date{
  font-size:12px;
  opacity:.85;
}
@media (max-width: 420px){
  .nums .mm-month{ font-size:13px; }
  .nums .en-date{ font-size:11.5px; }
}

/* === Make calendar full-width on one row, legend as next full-width block === */

/* 1) Turn the main wrapper into a vertical stack */
.wrap{
  display: flex;              /* override grid */
  flex-direction: column;
  gap: 16px;
  max-width: 1300px;          /* keep your current page width */
  margin: 0 auto;
}

/* 2) Reorder visually without touching HTML */
.calendar.card{ order: 1; width: 100%; }
.legend.card{   order: 2; width: 100%; }
.details.card{  order: 3; }

/* 3) Keep cards full width & spacing tidy */
.calendar.card, .legend.card, .details.card{
  align-self: stretch;
}

/* (Optional) legend list lay out nicely on wide rows */
.legend.card ul{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.legend.card li{
  margin: 0;                  /* we already have gap */
}

