:root {
  --ink: #10231f;
  --ink-soft: #3d5650;
  --mist: #e8f0eb;
  --paper: #f7fbf8;
  --panel: rgba(247, 251, 248, 0.88);
  --teal: #0f4c5c;
  --teal-deep: #0a3540;
  --mint: #7cb7a2;
  --line: rgba(15, 76, 92, 0.14);
  --shadow: 0 18px 40px rgba(16, 35, 31, 0.08);
  --radius: 18px;
  --font-display: "Songti TC", "Noto Serif TC", "PingFang TC", "Hiragino Mincho ProN", serif;
  --font-body: "PingFang TC", "Noto Sans TC", "Helvetica Neue", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(124, 183, 162, 0.35), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(15, 76, 92, 0.16), transparent 50%),
    linear-gradient(165deg, #dce9e1 0%, var(--mist) 42%, #f2f6f3 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(15, 76, 92, 0.08) 0.8px, transparent 0.8px);
  background-size: 18px 18px;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.hero {
  padding: 12px 4px 20px;
  animation: rise 0.55s ease both;
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--teal-deep);
  margin: 0;
}

.tagline {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 28em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: rise 0.65s ease both;
}

.panel + .panel {
  margin-top: 14px;
  animation-delay: 0.05s;
}

.controls {
  display: grid;
  gap: 10px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  padding: 0 12px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.12);
}

.month-nav {
  display: grid;
  grid-template-columns: 46px 1fr 1fr 46px;
  gap: 8px;
  align-items: end;
}

.icon-btn,
.btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 12px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.icon-btn {
  height: 46px;
  font-size: 1.4rem;
  line-height: 1;
}

.btn {
  height: 42px;
  padding: 0 14px;
  font-size: 0.92rem;
}

.btn:active,
.icon-btn:active,
.day:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #f7fbf8;
}

.btn-ghost {
  background: transparent;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 14px 2px 0;
}

.stats .count {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--teal);
  line-height: 1;
}

.stats .label {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.calendar-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.calendar-head span {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 4px 0;
}

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

.day {
  aspect-ratio: 1;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.day.empty {
  pointer-events: none;
  visibility: hidden;
}

.day:not(.empty) {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--line);
}

.day.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: #f4fbf8;
  font-weight: 700;
  animation: pop 0.22s ease;
}

.day.weekend:not(.selected) {
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.summary-panel h2,
.chips-panel h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--teal-deep);
}

.summary {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #10231f;
  color: #e7f2ec;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.copy-note {
  font-size: 0.85rem;
  color: var(--mint);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-note.show {
  opacity: 1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(124, 183, 162, 0.18);
  color: var(--teal-deep);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.install-banner {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(15, 76, 92, 0.35);
  background: rgba(124, 183, 162, 0.12);
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.install-banner.show {
  display: block;
}

.footer-note {
  margin: 18px 4px 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

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

@keyframes pop {
  from {
    transform: scale(0.92);
  }
  to {
    transform: scale(1);
  }
}

@media (min-width: 720px) {
  .app {
    padding-top: 36px;
  }

  .layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 14px;
    align-items: start;
  }

  .layout .panel {
    margin-top: 0;
  }
}

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