:root {
  --bg-body: #252625;
  --bg-app: #252625;
  --header-bg: rgba(37, 38, 37, 0.95);
  --text-main: #f8fafc;
  --text-muted: #a3a3a3;
  --card-bg: #252625;
  --col-red: #ef4444;
  --col-red-grad: linear-gradient(135deg, #ff3333, #c90000);
  --col-blue: #60a5fa;
  --col-blue-grad: linear-gradient(135deg, #60a5fa, #2563eb);
  --col-yellow: #fbbf24;
  --border-color: #222222;
  --glass-border: rgba(255, 255, 255, 0.05);
  --modal-overlay-bg: rgba(0, 0, 0, 0.9);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 20px 40px rgba(0, 0, 0, 0.8);
  --glow-yellow: rgba(251, 191, 36, 0.2);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

html.light-mode {
  --bg-body: #f1f5f9;
  --bg-app: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.95);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: #f8fafc;
  --col-red: #ef4444;
  --col-red-grad: linear-gradient(135deg, #ff1a1a, #b30000);
  --col-blue: #3b82f6;
  --col-blue-grad: linear-gradient(135deg, #60a5fa, #2563eb);
  --border-color: #e2e8f0;
  --glass-border: rgba(0, 0, 0, 0.05);
  --modal-overlay-bg: rgba(15, 23, 42, 0.4);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 20px 40px rgba(0, 0, 0, 0.1);
  --glow-yellow: rgba(245, 158, 11, 0.15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg-body);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: background-color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--col-blue);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 0 0 10px 0;
  background: var(--bg-app);
  color: var(--text-main);
  font-weight: 700;
}

.skip-link:focus {
  left: 0;
}

.app-container {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: background-color 0.4s ease, border 0.4s ease;
}

header {
  flex-shrink: 0;
  z-index: 10;
  padding: calc(24px + env(safe-area-inset-top)) 20px 16px;
  background-color: var(--header-bg);
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
  -webkit-user-select: none;
  user-select: none;
}

.bcm-logo {
  height: 38px;
  width: auto;
  border-radius: 8px;
  flex: none;
}

h1 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background-color: var(--card-bg);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  -webkit-user-select: none;
  user-select: none;
}

.nav-btn {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-app);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s ease;
}

.nav-btn:active {
  transform: scale(0.92);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.select-wrapper {
  flex-grow: 1;
  min-width: 0;
  text-align: center;
  position: relative;
}

select {
  width: 100%;
  padding: 8px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  text-align-last: center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

select option {
  background: var(--bg-app);
  color: var(--text-main);
}

#calendarView {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 15px 20px calc(40px + env(safe-area-inset-bottom));
  background-color: transparent;
  touch-action: pan-y;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#calendarView::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body.modal-open #calendarView {
  overflow: hidden;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.weekdays .sun {
  color: var(--col-red);
}

#gridContainer {
  flex: none;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 55px;
  padding-top: 10px;
  border-radius: 14px;
  background-color: transparent;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.day-cell.is-blank {
  visibility: hidden;
}

.day-cell.clickable {
  cursor: pointer;
}

.day-cell.clickable:active {
  transform: scale(0.92);
}

.grid-sym {
  position: absolute;
  top: 2px;
  right: 6px;
  color: var(--col-red);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
}

.date-number {
  z-index: 2;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.today-border {
  background: var(--glow-yellow);
  color: var(--col-yellow) !important;
  font-weight: 800;
  border: 2px solid var(--col-yellow) !important;
  box-shadow: 0 0 16px var(--glow-yellow);
}

.circle-red {
  background: var(--col-red-grad);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.circle-blue {
  background: var(--col-blue-grad);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.text-red {
  color: var(--col-red) !important;
  font-weight: 800;
}

.vawiin-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  margin: 28px 0 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  -webkit-user-select: none;
  user-select: none;
}

.btn-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--card-bg);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s ease;
}

.btn-bottom:active {
  transform: scale(0.95);
}

.btn-bottom svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.theme-btn .icon-moon {
  display: none;
}

html.light-mode .theme-btn .icon-sun {
  display: none;
}

html.light-mode .theme-btn .icon-moon {
  display: block;
}

.footer-lists {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.list-section {
  padding: 20px 24px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.list-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.list-header-red {
  color: var(--col-red);
}

.list-header-blue {
  color: var(--col-blue);
}

.list-header-dot {
  color: var(--col-red);
}

.list-header-star {
  color: var(--col-red);
  font-size: 0.9rem !important;
}

.head-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.head-sym {
  flex: none;
  font-size: 1.1rem;
  line-height: 1;
}

.holiday-list-ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.holiday-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.holiday-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.holiday-date {
  flex-shrink: 0;
  width: 95px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.holiday-name {
  min-width: 0;
  color: var(--text-main);
  font-weight: 500;
}

.symbol-red {
  margin-right: 2px;
  color: var(--col-red);
  font-size: 1.1rem;
  font-weight: 800;
}

.footer-signature {
  padding: 30px 0 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.footer-signature a {
  color: var(--text-main);
  text-decoration: none;
}

.footer-signature a:hover {
  text-decoration: underline;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeInModal 0.3s forwards;
}

.modal-content {
  width: 85%;
  max-width: 340px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px 28px;
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  background: var(--bg-app);
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-user-select: text;
  user-select: text;
}

.modal-date {
  margin-bottom: 12px;
  color: var(--col-blue);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.modal-text-wrap {
  margin-bottom: 26px;
}

.modal-event + .modal-event {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.modal-text {
  margin: 0 0 8px;
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
}

.modal-en {
  margin: 0 0 10px;
  color: var(--col-blue);
  font-size: 0.8rem;
  font-weight: 700;
}

.modal-desc {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.55;
}

.modal-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #25d366;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.modal-share:hover {
  text-decoration: underline;
}

.modal-btn {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  background: var(--col-blue);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal-btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}

.modal-share {
  display: none;
}

.noscript {
  margin: 20px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-main);
  text-align: center;
  font-weight: 600;
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInModal {
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (min-width: 500px) {
  .app-container {
    max-width: 440px;
    height: 94vh;
    max-height: 900px;
    border: 1px solid var(--glass-border);
    border-radius: 28px;
  }
}

@media (max-width: 420px) {
  .install-btn {
    width: 44px;
    justify-content: center;
    padding: 12px;
  }
  .install-btn span {
    display: none;
  }
}

@media (max-width: 359px) {
  header {
    padding: calc(18px + env(safe-area-inset-top)) 14px 14px;
  }
  .header-content {
    gap: 10px;
    margin-bottom: 18px;
  }
  .bcm-logo {
    height: 34px;
  }
  h1 {
    font-size: 1.18rem;
  }
  .nav-btn {
    width: 38px;
    height: 38px;
  }
  .nav-btn svg {
    width: 18px;
    height: 18px;
  }
  select {
    padding: 8px 4px;
    font-size: 0.9rem;
  }
  #calendarView {
    padding: 12px 14px calc(34px + env(safe-area-inset-bottom));
  }
  .weekdays {
    margin-bottom: 9px;
    font-size: 0.66rem;
    letter-spacing: 0.5px;
  }
  .days-grid {
    gap: 4px;
  }
  .day-cell {
    min-height: 48px;
    padding-top: 6px;
  }
  .date-number {
    width: 32px;
    height: 32px;
    font-size: 0.98rem;
  }
  .grid-sym {
    right: 3px;
    font-size: 0.75rem;
  }
  .btn-bottom {
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.88rem;
  }
  .vawiin-wrap {
    gap: 8px 10px;
    margin: 22px 0 20px;
  }
  .list-section {
    padding: 16px;
    border-radius: 16px;
  }
  .list-section h3 {
    margin-bottom: 12px;
    font-size: 0.98rem;
  }
  .holiday-item {
    padding: 10px 0;
    font-size: 0.9rem;
  }
  .holiday-date {
    width: 80px;
    font-size: 0.8rem;
  }
  .modal-content {
    width: 92%;
    padding: 26px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
