:root {
  --paper: #f1efe8;
  --paper-warm: #e7e1d5;
  --card: rgba(255, 255, 252, 0.84);
  --ink: #14201c;
  --muted: #66706b;
  --line: rgba(20, 32, 28, 0.13);
  --orange: #e85f3b;
  --orange-dark: #ad3f25;
  --green: #1d6b51;
  --blue: #315bda;
  --shadow: 0 26px 90px rgba(38, 43, 36, 0.13);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.92), transparent 32rem),
    radial-gradient(circle at 92% 10%, rgba(232, 95, 59, 0.14), transparent 24rem),
    linear-gradient(145deg, var(--paper) 0%, var(--paper-warm) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.location-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 3.5rem);
}

.location-shell {
  width: min(100%, 67rem);
}

.site-header,
.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.eyebrow,
.card-label,
.record-kicker,
.meta-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.title,
.admin-title,
.panel-title,
.location,
.preview-location,
.record-location,
.auto-location {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

.title {
  margin: 0.45rem 0 0;
  font-size: clamp(2.65rem, 6.8vw, 6rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

.week-stamp {
  min-width: 8.2rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.44);
  text-align: right;
}

.week-stamp span,
.week-stamp strong {
  display: block;
}

.week-stamp span {
  color: var(--orange-dark);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.week-stamp strong {
  margin-top: 0.2rem;
  font-size: 1rem;
}

.current-card,
.record-card,
.panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.current-card {
  position: relative;
  overflow: hidden;
  margin-top: 2rem;
  padding: clamp(1.6rem, 4vw, 3.1rem);
  border-radius: 2rem;
  background: linear-gradient(145deg, rgba(255, 255, 253, 0.96), rgba(250, 246, 238, 0.85));
}

.current-card::after {
  content: "";
  position: absolute;
  top: -7rem;
  right: -5rem;
  width: 19rem;
  height: 19rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 95, 59, 0.19), transparent 67%);
  pointer-events: none;
}

.current-card.is-unknown::after {
  background: radial-gradient(circle, rgba(49, 91, 218, 0.16), transparent 67%);
}

.current-card.is-out::after {
  background: radial-gradient(circle, rgba(102, 112, 107, 0.16), transparent 67%);
}

.status-line,
.record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.48rem 0.75rem;
  background: rgba(29, 107, 81, 0.09);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.source-pill.manual {
  background: rgba(232, 95, 59, 0.1);
  color: var(--orange-dark);
}

.source-pill::before {
  content: "";
  display: block;
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0.22rem rgba(29, 107, 81, 0.12);
}

.source-pill.manual::before {
  box-shadow: 0 0 0 0.22rem rgba(232, 95, 59, 0.13);
}

.location {
  position: relative;
  z-index: 1;
  margin: 1.1rem 0 1.8rem;
  max-width: 48rem;
  font-size: clamp(3.5rem, 9vw, 7.8rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.9;
}

.is-unknown .location,
.is-out .location {
  font-size: clamp(3rem, 8vw, 6.8rem);
}

.current-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.meta-value {
  margin: 0.3rem 0 0;
  font-size: 1.05rem;
  font-weight: 750;
}

.time-window {
  text-align: right;
}

.override-note {
  margin: 1.2rem 0 0;
  color: var(--orange-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.comments-section {
  margin-top: clamp(2.4rem, 6vw, 5rem);
}

.comments-header,
.comments-panel-heading,
.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.comments-title {
  margin: 0.35rem 0 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(2.3rem, 5vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
}

.comments-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.comments-grid {
  display: grid;
  grid-template-columns: minmax(17rem, 0.82fr) minmax(0, 1.18fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

.comment-form-panel,
.comments-panel {
  box-shadow: 0 18px 60px rgba(38, 43, 36, 0.1);
}

.field textarea {
  width: 100%;
  min-height: 8rem;
  border: 1px solid rgba(20, 32, 28, 0.18);
  border-radius: 0.9rem;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  line-height: 1.5;
  resize: vertical;
}

.field textarea:focus {
  outline: 3px solid rgba(232, 95, 59, 0.16);
  border-color: rgba(232, 95, 59, 0.5);
}

.comments-panel-heading h3 {
  margin: 0.35rem 0 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.comments-panel-heading > span,
.older-comments summary span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: rgba(20, 32, 28, 0.08);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.comments-scroll {
  max-height: 24rem;
  margin-top: 1rem;
  padding-right: 0.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(20, 32, 28, 0.24) transparent;
}

.comments-scroll:focus-visible {
  outline: 3px solid rgba(49, 91, 218, 0.16);
  outline-offset: 0.25rem;
}

.comment-list {
  display: grid;
  gap: 0.75rem;
}

.comment-item {
  padding: 1rem;
  border: 1px solid rgba(20, 32, 28, 0.09);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.62);
}

.comment-name,
.comment-body {
  margin: 0;
}

.comment-name {
  font-weight: 800;
}

.comment-meta time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.comment-body {
  margin-top: 0.65rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.comment-empty {
  margin: 1.25rem 0 0;
  color: var(--muted);
}

.older-comments {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.older-comments summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.older-comments summary::-webkit-details-marker {
  display: none;
}

.older-comments summary::before {
  content: "+";
  margin-right: 0.3rem;
  color: var(--orange-dark);
}

.older-comments[open] summary::before {
  content: "−";
}

.older-comments summary span {
  margin-left: auto;
}

.older-scroll {
  max-height: 20rem;
}

.record-card {
  min-height: 11.5rem;
  padding: 1.4rem;
  border-radius: 1.45rem;
  background: var(--card);
}

.record-location {
  margin: 1.25rem 0 0;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  letter-spacing: -0.035em;
  line-height: 1;
}

.record-heading span {
  margin-top: 1.25rem;
  border-radius: 999px;
  padding: 0.28rem 0.5rem;
  background: rgba(20, 32, 28, 0.07);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.record-activity,
.record-time,
.preview-time,
.preview-detail,
.panel-copy {
  color: var(--muted);
  line-height: 1.55;
}

.record-activity {
  margin: 0.85rem 0 0;
  font-weight: 650;
}

.record-time {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}

.site-footer {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer p {
  margin: 0;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.accuracy-note {
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  line-height: 1.5;
  text-align: center;
}

.admin-page {
  min-height: 100vh;
  padding: clamp(1.2rem, 4vw, 3rem);
}

.admin-shell {
  width: min(100%, 67rem);
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 2.2rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: var(--orange-dark);
}

.admin-title {
  margin: 0.35rem 0 0;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.85fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.login-grid {
  margin-top: 0;
}

.panel {
  border-radius: 1.55rem;
  padding: clamp(1.35rem, 3vw, 2rem);
  background: rgba(255, 255, 252, 0.84);
}

.preview-panel {
  background: rgba(248, 244, 236, 0.78);
}

.panel-title {
  margin: 0.6rem 0 0;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.panel-copy {
  margin: 0.75rem 0 0;
}

.form-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.4rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  font-weight: 750;
}

.field span {
  font-size: 0.9rem;
}

.field input,
.field select {
  width: 100%;
  min-height: 3.2rem;
  border: 1px solid rgba(20, 32, 28, 0.18);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(232, 95, 59, 0.16);
  border-color: rgba(232, 95, 59, 0.5);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 10rem;
  min-height: 3rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

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

.button-secondary,
.button-quiet {
  margin-top: 1rem;
  background: rgba(20, 32, 28, 0.08);
  color: var(--ink);
}

.button-quiet {
  min-width: auto;
}

.preview-location {
  margin: 1rem 0 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.preview-time,
.preview-detail {
  margin: 0.7rem 0 0;
}

.auto-preview {
  margin-top: 1.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.auto-location {
  margin: 0.8rem 0 0;
  font-size: 1.8rem;
}

.notice {
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  line-height: 1.45;
}

.notice.success {
  background: rgba(29, 107, 81, 0.1);
  color: var(--green);
}

.notice.error {
  background: rgba(173, 63, 37, 0.1);
  color: var(--orange-dark);
}

@media (max-width: 760px) {
  .site-header,
  .admin-header {
    align-items: start;
  }

  .week-stamp {
    min-width: 6.8rem;
    padding: 0.8rem;
  }

  .current-card {
    margin-top: 1.25rem;
    border-radius: 1.5rem;
  }

  .current-meta,
  .record-grid,
  .admin-grid,
  .comments-grid {
    grid-template-columns: 1fr;
  }

  .time-window {
    text-align: left;
  }

  .record-card {
    min-height: 0;
  }

  .footer-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .comments-header,
  .comment-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }
}

@media (max-width: 480px) {
  .location-page {
    place-items: start center;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
  }

  .status-line,
  .record-heading {
    align-items: flex-start;
  }

  .source-pill {
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
