:root {
  --accent: #ff8200;
  --accent-blue-deep: #003f5f;
  --mchs-stripe-orange: rgba(255, 130, 0, 0.96);
  --mchs-stripe-blue: rgba(0, 103, 168, 0.94);
  --mchs-grid-horizontal: rgba(255, 255, 255, 0.07);
  --mchs-grid-vertical: rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Bahnschrift", "Trebuchet MS", "Segoe UI", sans-serif;
  color: #2b211d;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 2%, rgba(0, 115, 180, 0.62), transparent 34%),
    radial-gradient(circle at 82% 88%, rgba(0, 0, 0, 0.22), transparent 34%),
    linear-gradient(180deg, #006aa6 0%, #003f5f 42%, #001725 72%, #00090d 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      to top,
      transparent 0,
      transparent 28px,
      var(--mchs-stripe-orange) 28px,
      var(--mchs-stripe-orange) 42px,
      var(--mchs-stripe-blue) 42px,
      var(--mchs-stripe-blue) 50px,
      var(--mchs-stripe-orange) 50px,
      var(--mchs-stripe-orange) 62px,
      transparent 62px,
      transparent 100%
    ),
    linear-gradient(var(--mchs-grid-horizontal) 1px, transparent 1px),
    linear-gradient(90deg, var(--mchs-grid-vertical) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

body.calendar-page {
  background: #071520;
}

.hidden {
  display: none !important;
}

.calendar-shell {
  width: min(430px, calc(100% - 24px));
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
  color: #f4fbff;
}

.calendar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mchs-emblem-shell {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  place-items: center;
  padding: 10px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(13, 34, 50, 0.9), rgba(6, 18, 28, 0.74));
  box-shadow: 0 18px 34px rgba(0, 7, 14, 0.34);
}

.mchs-emblem-shell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.calendar-brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-title {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 3.35rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.9;
  text-transform: uppercase;
}

.calendar-page .calendar-brand .brand-title {
  position: relative;
  width: fit-content;
  color: #c9a227;
  text-shadow: none;
  background-image: linear-gradient(
    90deg,
    #8a5a12 0%,
    #c9a227 8%,
    #ffe08a 16%,
    #fff8d6 25%,
    #ffe08a 34%,
    #c9a227 42%,
    #8a5a12 50%,
    #c9a227 58%,
    #ffe08a 66%,
    #fff8d6 75%,
    #ffe08a 84%,
    #c9a227 92%,
    #8a5a12 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(201, 162, 39, 0.28));
  animation: calendar-gold-wave 4.8s linear infinite;
}

@keyframes calendar-gold-wave {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-page .calendar-brand .brand-title {
    animation: none;
    background-position: 25% 50%;
  }
}

.calendar-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.brand-subtitle {
  margin: 0;
  flex: 0 0 auto;
  color: #ffb15c;
  font-size: clamp(1rem, 1.4vw, 1.45rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.calendar-shell h1 {
  margin: 16px 0 6px;
  font-size: 1.45rem;
}

.calendar-today {
  margin: 0 0 10px;
  color: #9ab5c8;
}

.duty-calendar {
  display: flex;
  flex-direction: column;
  height: min(58dvh, 560px);
  margin-top: 14px;
  padding: 12px 10px 0;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 28px;
  background: #fff;
  color: #111827;
}

.duty-months {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 18px;
  scrollbar-width: thin;
}

.calendar-page .calendar-brand .mchs-emblem-shell {
  position: relative;
  isolation: isolate;
  overflow: visible;
}

.calendar-page .calendar-brand .mchs-emblem-shell::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--calendar-border-angle, 0deg),
    #8a5a12 0%,
    #c9a227 12%,
    #ffe08a 22%,
    #fff8d6 32%,
    #ffe08a 42%,
    #c9a227 52%,
    #8a5a12 62%,
    #c9a227 72%,
    #ffe08a 82%,
    #fff8d6 90%,
    #c9a227 96%,
    #8a5a12 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: calendar-border-spin 6s linear infinite;
  pointer-events: none;
}

.calendar-page .calendar-brand .mchs-emblem-shell img {
  position: relative;
  z-index: 1;
}

@property --calendar-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes calendar-border-spin {
  from {
    --calendar-border-angle: 0deg;
  }
  to {
    --calendar-border-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-page .calendar-brand .mchs-emblem-shell::before {
    animation: none;
  }
}

.duty-weekdays,
.duty-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px 0;
  text-align: center;
}

.duty-weekdays {
  flex: 0 0 auto;
  margin-bottom: 6px;
  padding-bottom: 6px;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: #fff;
}

.duty-month h2 {
  margin: 16px 0 10px;
  text-align: center;
  font-size: 1.2rem;
}

.duty-month:first-child h2 {
  margin-top: 6px;
}

.duty-day {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 800;
  color: #111827;
}

.duty-day.is-empty {
  visibility: hidden;
}

.duty-day.is-duty {
  background: #2f8f96;
  color: #fff;
}

.duty-day.is-today {
  background: #ef4444;
  color: #fff;
}

.duty-guard-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.duty-guard-row button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d7e7f2;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
}

.duty-guard-row button.is-active {
  background: #2f8f96;
  border-color: #2f8f96;
  color: #fff;
}
