:root {
  --bg: #f3f7fc;
  --card: #ffffff;
  --ink: #0a2e49;
  --muted: #4a6174;
  --accent: #0078c8;
  --accent-dark: #005b98;
  --line: #d8e4ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #eaf2fb 0%, #f8fbff 45%, #eef7ff 100%);
  min-height: 100vh;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 15px 30px rgba(3, 39, 69, 0.08);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.55rem;
}

.lead {
  margin: 0;
  color: var(--muted);
}

.search-mode {
  margin-top: 0.7rem;
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  flex-wrap: wrap;
}

.search-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  padding: 0.22rem 0.45rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dbe8f3;
}

.search-mode-option input {
  margin: 0;
}

.data-source-status {
  margin: 0.45rem 0 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #dbe7f3;
  border-radius: 0.55rem;
  background: #f7fbff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.data-source-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.1rem 0.5rem;
  border: 1px solid transparent;
}

.data-source-badge.server {
  background: #e8f3ff;
  color: #1e5a84;
  border-color: #c8def3;
}

.data-source-badge.browser {
  background: #fff3df;
  color: #7a4f0f;
  border-color: #eed9b5;
}

.data-source-detail {
  font-size: 0.76rem;
  color: #4a6275;
  line-height: 1.35;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-top: 1rem;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

label {
  font-weight: 600;
}

input[type="date"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.72rem;
  font-size: 1rem;
  height: 52px;
  min-height: 52px;
}

input[type="text"],
input[type="number"],
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.72rem;
  font-size: 1rem;
  width: 100%;
  height: 52px;
  min-height: 52px;
}

.field {
  display: grid;
  gap: 0.35rem;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.status {
  min-height: 1.3rem;
  color: var(--muted);
  margin: 0.8rem 0 0;
}

.hotel-year-card {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.7rem;
}

.hotel-year-card h2 {
  margin: 0;
  font-size: 1rem;
}

.hotel-year-form {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.hotel-year-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.hotel-year-small {
  max-width: 200px;
}

.hotel-year-options {
  margin-top: 0.1rem;
}

.hotel-year-submit {
  height: 32px;
  min-height: 32px;
  padding: 0.25rem 0.5rem;
  font-size: 0.84rem;
}

#hotel-year-filter-room {
  width: 72px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

#hotel-year-filter-max-price {
  width: 82px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

#hotel-year-top-count {
  width: 68px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

.result {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.hidden {
  display: none;
}

.winner {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6fbff;
  padding: 0.85rem;
}

.winner p {
  margin: 0.2rem 0;
}

.price {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0265a8;
}

#winner-link {
  display: inline-block;
  margin-top: 0.35rem;
  text-decoration: none;
  color: var(--accent-dark);
  font-weight: 700;
}

.top-list {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
}

.top-list li {
  margin: 0.28rem 0;
}

.top-list a {
  color: var(--accent-dark);
  text-decoration: none;
}

.seven-day {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.6rem;
}

.seven-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.seven-day h3 {
  margin: 0;
  font-size: 1rem;
}

.seven-day-nav {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 7px;
  padding: 0;
  line-height: 1;
  font-size: 0.9rem;
  font-weight: 700;
}

.seven-day-status {
  margin: 0.3rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.seven-day-wrap {
  width: 100%;
  overflow-x: auto;
}

.seven-day-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.84rem;
}

.seven-day-table th,
.seven-day-table td {
  border: 1px solid var(--line);
  padding: 0.38rem 0.32rem;
  text-align: center;
  vertical-align: middle;
}

.seven-day-table thead th {
  background: #f3f8fe;
  color: #274a63;
  font-weight: 700;
}

.seven-day-table thead th.day-sortable {
  cursor: pointer;
}

.seven-day-table thead th.day-sortable:hover {
  background: #e7f1ff;
}

.seven-day-table thead th.day-sortable.active-sort {
  background: #ddecff;
}

.seven-day-table th.hotel-col,
.seven-day-table td.hotel-col {
  text-align: left;
  width: 24%;
  min-width: 180px;
  font-weight: 600;
  color: #18374e;
}

.seven-day-table .day-top {
  display: block;
  font-size: 0.72rem;
  color: #4b6678;
  font-weight: 600;
}

.seven-day-table .day-date {
  display: block;
  font-size: 0.8rem;
}

.seven-day-table th.selected-day,
.seven-day-table td.selected-day {
  background: #e9f3ff;
}

.seven-day-price-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.yearly-top-dates {
  text-align: left;
  font-size: 0.8rem;
}

.yearly-top-dates summary {
  cursor: pointer;
  color: #2f5f86;
  font-weight: 600;
}

.yearly-top-dates ol {
  margin: 0.35rem 0 0.15rem;
  padding-left: 1.1rem;
  columns: 2;
  column-gap: 1.2rem;
}

.yearly-top-dates li {
  margin: 0.16rem 0;
  break-inside: avoid;
}

.yearly-main-row td {
  border-bottom-width: 0;
}

.yearly-expand-row td {
  border-top-width: 0;
  background: #fbfdff;
}

.yearly-expand-cell {
  padding: 0.2rem 0.45rem 0.45rem;
}

#hotel-year-table th:first-child,
#hotel-year-table td:first-child {
  width: 3rem;
  min-width: 3rem;
  max-width: 3rem;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

#hotel-year-table th.hotel-col,
#hotel-year-table td.hotel-col {
  width: 36%;
  min-width: 260px;
}

.hotel-feature-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.feature-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d4e3f2;
  border-radius: 999px;
  padding: 0.06rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #345267;
  background: #f3f8fd;
}

.top-controls {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.35rem;
}

.top-controls h3 {
  margin: 0;
  flex: 0 0 100%;
}

.top-options {
  display: flex;
  align-items: center;
  gap: 0.3rem 0.45rem;
  flex-wrap: wrap;
  width: 100%;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.84rem;
}

.unique-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  font-size: 0.84rem;
}

.unique-toggle-label input {
  margin: 0;
  width: 16px;
  height: 16px;
}

.top-flag-label {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
  white-space: nowrap;
}

.top-flag-label input {
  margin: 0;
  width: 16px;
  height: 16px;
}

.top-count-label {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  white-space: nowrap;
}

#top-count {
  width: 68px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

.sort-by-label {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  white-space: nowrap;
}

#sort-by {
  width: 96px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
  max-width: 100%;
}

#filter-room-code {
  width: 72px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

#filter-max-price {
  width: 82px;
  height: 32px;
  min-height: 32px;
  padding: 0.22rem 0.36rem;
  font-size: 0.84rem;
}

.map-toggle {
  margin-top: 0.85rem;
}

.map-wrap {
  margin-top: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f3f3;
}

.hotel-map {
  width: 100%;
  height: 500px;
}

.map-wrap.no-tiles .hotel-map {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px) 0 0 / 28px 28px,
    #d7d7d7;
}

.map-status {
  margin: 0;
  padding: 0.4rem 0.65rem 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #f7fbff;
}

.rank-marker-wrap {
  background: transparent;
  border: 0;
}

.rank-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(6, 30, 53, 0.35);
  user-select: none;
}

.rank-marker.regular {
  background: #0a67b3;
}

.rank-marker.cheapest {
  background: #168d4a;
}

.focus-marker-wrap {
  background: transparent;
  border: 0;
}

.focus-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #8a3f00;
  border: 2px solid #fff;
  background: #f6a23b;
  box-shadow: 0 2px 8px rgba(6, 30, 53, 0.35);
  user-select: none;
}

.code-key {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafcff;
  padding: 0.75rem;
}

.code-key h3 {
  margin: 0 0 0.35rem;
}

.code-key p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.code-key code {
  background: #edf4fb;
  border: 1px solid #d7e5f2;
  border-radius: 5px;
  padding: 0.02rem 0.32rem;
  font-size: 0.9em;
}

.footnote {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 1rem 0 0;
}

@media (min-width: 520px) {
  .card {
    padding: 1.7rem;
  }

  .search-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: end;
    gap: 0.55rem;
  }

  .search-row .field {
    min-width: 0;
  }

  .search-row .field:nth-child(1) {
    flex: 1.15 1 0;
  }

  .search-row .field:nth-child(2) {
    flex: 1.55 1 0;
  }

  .search-row .field:nth-child(3) {
    flex: 1.55 1 0;
  }

  .search-row .field:nth-child(4),
  .search-row .field:nth-child(5) {
    flex: 1 1 0;
  }

  .hotel-year-form {
    grid-template-columns: 1fr;
  }

  .hotel-year-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: end;
    gap: 0.55rem;
  }

  .hotel-year-row .field {
    min-width: 0;
  }

  .hotel-year-row .field:nth-child(1),
  .hotel-year-row .field:nth-child(2),
  .hotel-year-row .field:nth-child(3) {
    flex: 1.45 1 0;
  }

  .hotel-year-row .field:nth-child(4),
  .hotel-year-row .field:nth-child(5),
  .hotel-year-row .field:nth-child(6) {
    flex: 0.85 1 0;
  }

  h1 {
    font-size: 2rem;
  }

  .hotel-map {
    height: 620px;
  }
}
