
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --line: #d9dde5;
  --line-strong: #c7ccd6;
  --text: #1f2937;
  --muted: #6b7280;
  --blue: #315efb;
  --blue-soft: #eef3ff;
  --today-ring: #315efb;
  --holiday: #ef4444;
  --holiday-soft: #fff1f1;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  --radius: 18px;
  --cell-height: 144px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  line-height: 1.4;
}
button, input, select { font: inherit; }
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.top-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #315efb, #5b5ce8);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
.summary-copy { min-width: 0; }
.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.title-row h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}
.summary-chip, .panel-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}
.muted-chip {
  background: #f8fafc;
  color: var(--muted);
}
.summary-links {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.link-button {
  border: 0;
  background: transparent;
  color: #111827;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}
.status-inline {
  color: var(--holiday);
  min-height: 22px;
}
.calendar-shell { overflow: hidden; }
.controls-bar {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.control-left {
  display: flex;
  gap: 10px;
}
.control-left label,
.converter-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.control-left span,
.converter-form span {
  font-size: 12px;
  color: var(--muted);
}
select, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 44px;
  padding: 10px 12px;
}
.control-center {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
}
.icon-button, .primary-button {
  border: 0;
  cursor: pointer;
}
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #eef2f7;
  color: #374151;
  font-size: 30px;
  line-height: 1;
}
.month-center-copy {
  text-align: center;
  min-width: 0;
}
.month-center-copy h2 {
  margin: 0;
  font-size: 22px;
}
.month-subline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: var(--cell-height);
  gap: 1px;
  background: var(--line);
}
.weekday-cell {
  min-height: 52px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  text-align: center;
  padding: 6px 4px;
  background: #fcfcfd;
}
.weekday-cell:nth-child(7n) { border-right: 0; }
.weekday-np { font-size: 14px; font-weight: 700; }
.weekday-en { font-size: 11px; color: #9ca3af; font-weight: 700; letter-spacing: 0.04em; }
.calendar-cell,
.calendar-empty {
  position: relative;
  min-width: 0;
  min-height: var(--cell-height);
  background: #fff;
}
.calendar-empty { background: #fafafa; }
.calendar-cell {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.calendar-cell:hover { background: #fbfdff; }
.calendar-cell.selected { box-shadow: inset 0 0 0 2px #8aa3ff; z-index: 1; }
.calendar-cell.today { box-shadow: inset 0 0 0 3px var(--today-ring); z-index: 2; background: #f8fbff; }
.calendar-cell.today.selected { box-shadow: inset 0 0 0 3px var(--today-ring); }
.calendar-cell.holiday { background: var(--holiday-soft); }
.calendar-cell.holiday .day-bs,
.calendar-cell.holiday .event-label,
.calendar-cell.holiday .day-tithi,
.calendar-cell.holiday .day-ad { color: var(--holiday); }
.event-label {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  min-height: 16px;
  font-size: 12px;
  line-height: 1.15;
  color: var(--holiday);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-label.muted { color: transparent; }
.day-bs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  color: #111827;
}
.day-ad {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1;
}
.day-tithi {
  position: absolute;
  left: 10px;
  right: 48px;
  bottom: 8px;
  font-size: 12px;
  color: #111827;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.bottom-grid,
.converter-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.bottom-grid { grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr); }
.converter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.details-panel,
.festivals-panel,
.converter-grid > .card { padding: 18px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h3,
.festivals-panel h3,
.converter-grid h3 { margin: 0; }
.selected-day-empty { color: var(--muted); margin-top: 12px; }
.details-list { display: grid; gap: 10px; margin-top: 12px; }
.detail-row { border-top: 1px solid var(--line); padding-top: 10px; }
.detail-label { font-size: 12px; color: var(--muted); }
.detail-value { margin-top: 4px; word-break: break-word; }
.festival-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.festival-list li {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}
.festival-list li.holiday-item {
  border-color: #fecaca;
  background: #fff5f5;
}
.converter-form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.primary-button {
  min-height: 46px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}
.result-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fcfdff;
}
.no-data {
  grid-column: 1 / -1;
  padding: 16px;
  color: var(--muted);
}
@media (max-width: 980px) {
  .controls-bar,
  .bottom-grid,
  .converter-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --cell-height: 112px; }
  .container { padding: 10px; }
  .top-summary { grid-template-columns: 52px minmax(0,1fr); gap: 10px; }
  .brand-mark { width: 48px; height: 48px; font-size: 24px; }
  .title-row h1 { font-size: 18px; }
  .control-left { flex-direction: column; }
  .month-center-copy h2 { font-size: 18px; }
  .weekday-cell { min-height: 46px; }
  .weekday-np { font-size: 12px; }
  .weekday-en { font-size: 10px; }
  .event-label { top: 6px; left: 6px; right: 6px; font-size: 10px; min-height: 14px; }
  .day-bs { font-size: 38px; }
  .day-ad, .day-tithi { font-size: 10px; bottom: 6px; }
  .day-ad { right: 6px; }
  .day-tithi { left: 6px; right: 40px; }
  .form-grid { grid-template-columns: 1fr; }
}
