:root {
  color-scheme: light;
  --bg: #f6f3ed;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #dfd8cb;
  --accent: #a64228;
  --accent-dark: #7d2e1b;
  --olive: #52643a;
  --gold: #d99a24;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(24, 33, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(166, 66, 40, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(82, 100, 58, 0.13), transparent 42%),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 66, 40, 0.16);
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px 32px;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 24px;
  font-weight: 850;
}

.login-panel h1,
.topbar h1 {
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.login-panel p,
.section-heading p,
.selected-place p,
.provider-note {
  color: var(--muted);
}

.login-form,
.rating-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label,
.rating-form label {
  display: grid;
  gap: 7px;
}

.login-form span,
.field-label,
.manual-form span {
  color: #344054;
  font-size: 14px;
  font-weight: 750;
}

.main-view {
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 8px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--olive);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.8);
  color: var(--ink);
}

.search-section,
.rating-panel,
.list-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 12px 32px rgba(24, 33, 47, 0.08);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-heading h2,
.rating-panel h2 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.search-box {
  position: relative;
}

.search-box input {
  padding-right: 48px;
}

.icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 40px;
  min-height: 40px;
  place-items: center;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.search-results,
.ratings-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.manual-add {
  margin-top: 14px;
}

.manual-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.manual-form label {
  display: grid;
  gap: 7px;
}

.result-item,
.rating-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.result-item {
  cursor: pointer;
  text-align: left;
}

.result-item:hover {
  border-color: rgba(166, 66, 40, 0.48);
}

.place-photo {
  width: 86px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(166, 66, 40, 0.82), rgba(217, 154, 36, 0.72)),
    #d6aa67;
}

.place-photo.has-image {
  background-size: cover;
  background-position: center;
}

.placeholder-letter {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 28px;
  font-weight: 850;
}

.result-text,
.rating-text {
  min-width: 0;
}

.result-text strong,
.rating-text strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.result-text span,
.rating-text span,
.rating-text p {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.selected-place {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.selected-place .place-photo {
  width: 110px;
}

.stars-input,
.stars-readonly {
  display: inline-flex;
  gap: 4px;
  min-height: 44px;
  align-items: center;
}

.star-button {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: #9aa1ad;
  font-size: 25px;
  line-height: 1;
}

.star-button.active {
  border-color: rgba(217, 154, 36, 0.7);
  color: var(--gold);
}

.stars-readonly {
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions button {
  min-width: 140px;
  padding: 0 16px;
}

.rating-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.rating-actions button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.danger-button {
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: #fff;
  color: var(--danger);
}

.empty-state,
.loading-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.46);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    padding: max(14px, env(safe-area-inset-top)) 12px 24px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .search-section,
  .rating-panel,
  .list-section,
  .login-panel {
    padding: 14px;
  }

  .result-item,
  .rating-item {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
  }

  .place-photo {
    width: 74px;
  }

  .selected-place {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .selected-place .place-photo {
    width: 84px;
  }

  .star-button {
    width: 38px;
  }
}
