:root {
  color-scheme: dark;
  --bg: #10120f;
  --panel: rgba(255, 252, 242, 0.1);
  --panel-strong: rgba(255, 252, 242, 0.16);
  --text: #fff9ec;
  --muted: #cbbfa9;
  --line: rgba(255, 255, 255, 0.18);
  --accent: #e35d5b;
  --accent-2: #f5b461;
  --ink: #1b1714;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(16, 18, 15, 0.58), rgba(70, 28, 40, 0.62)),
    url("assets/background-romantic.jpg") center/contain fixed;
  background-color: #2f1b22;
  background-repeat: no-repeat;
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

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

.login-panel {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.login-panel.is-opening {
  animation: panelFadeOut 0.75s ease 0.55s forwards;
}

.vault-chest {
  position: relative;
  width: min(100%, 300px);
  height: 196px;
  margin: 0 auto 22px;
  perspective: 900px;
  transform: rotateX(4deg) rotateY(-8deg);
  transform-style: preserve-3d;
}

.chest-base,
.chest-lid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.42));
  transform-style: preserve-3d;
}

.chest-base {
  clip-path: inset(42% 0 0 0);
  transform: translateZ(10px);
}

.vault-chest::before {
  content: "";
  position: absolute;
  left: 38px;
  right: 28px;
  bottom: 27px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(58, 31, 24, 0.92), rgba(25, 15, 13, 0.54));
  transform: translateZ(-18px) translateX(16px) skewY(-5deg);
  filter: blur(1px);
  opacity: 0.7;
}

.chest-lid {
  clip-path: inset(0 0 42% 0);
  transform: translateZ(18px);
  transform-origin: 50% 56%;
  transition: transform 0.78s cubic-bezier(0.2, 0.8, 0.22, 1), filter 0.78s ease;
  z-index: 2;
}

.chest-glow {
  position: absolute;
  left: 50%;
  top: 80px;
  width: 170px;
  height: 80px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 180, 97, 0.46), rgba(245, 180, 97, 0));
  opacity: 0;
  pointer-events: none;
}

.vault-chest.is-open .chest-lid {
  transform: translateY(-44px) translateZ(28px) rotateX(66deg) scale(1.02);
  filter: drop-shadow(0 30px 26px rgba(0, 0, 0, 0.38));
}

.vault-chest.is-open .chest-glow {
  animation: treasureGlow 0.9s ease forwards;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

@keyframes treasureGlow {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.72);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes panelFadeOut {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
}

.love-names span {
  color: #ff8d86;
}

.love-names {
  font-size: clamp(0.95rem, 3vw, 1.25rem);
  text-align: center;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 26px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.35rem, 7vw, 4.7rem);
  line-height: 0.95;
}

.login-form,
.memory-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  outline: 0;
}

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

select {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  min-height: 112px;
  padding: 12px 14px;
}

input:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(245, 180, 97, 0.17);
}

.form-message {
  min-height: 20px;
  margin: -6px 0 0;
  color: #ffb4a9;
  font-size: 0.86rem;
}

.login-form button,
.memory-form button,
.watch-form button {
  min-height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink);
  font-weight: 800;
}

.memory-form .ghost-button {
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
}

.memory-view {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.is-hidden {
  display: none;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
}

.topbar h1 {
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-button {
  min-width: 86px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font-weight: 800;
}

.primary-small-button {
  min-width: 110px;
  min-height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink);
  font-weight: 800;
}

.subtle-button {
  min-width: 96px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.subtle-button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 252, 242, 0.12);
  color: var(--text);
}

.import-button {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.import-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.love-counter {
  margin: 6px 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.68);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

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

.counter-grid div {
  min-height: 78px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.08);
}

.counter-grid strong {
  color: var(--accent-2);
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1;
}

.counter-grid span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.composer {
  margin-top: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.composer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.composer-header h2 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 1.55rem;
}

.places-view,
.watch-view {
  margin-top: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.places-header,
.watch-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.places-header h2,
.watch-header h2 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 1.55rem;
}

.selected-city {
  min-height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.08);
  color: var(--accent-2);
  font-weight: 800;
}

.turkey-map {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.turkey-map svg {
  width: min(100%, 980px);
  max-width: 100%;
  min-width: 0;
  height: auto;
  display: block;
  margin: 0 auto;
}

.province-shape {
  fill: #fff8c9 !important;
  stroke: #9b764b !important;
  stroke-width: 1.1 !important;
  cursor: pointer;
  transition: fill 0.16s ease, filter 0.16s ease;
}

.province-shape:hover,
.province-shape.is-selected {
  filter: drop-shadow(0 0 5px rgba(28, 111, 67, 0.34));
}

.province-shape.is-visited {
  fill: #32c878 !important;
}

.visited-list {
  margin-top: 14px;
}

.visited-list h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1rem;
}

.visited-city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.visited-city-pill {
  padding: 7px 10px;
  border: 1px solid rgba(185, 255, 205, 0.38);
  border-radius: 999px;
  background: rgba(50, 200, 120, 0.18);
  color: #b9ffcd;
  font-size: 0.82rem;
}

.watch-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.35fr) minmax(96px, 0.2fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.watch-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.watch-columns section {
  min-height: 170px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.08);
}

.watch-columns h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 1rem;
}

.watch-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.watch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}

.watch-item button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 800;
}

.file-picker {
  min-height: 150px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.file-picker strong {
  color: var(--text);
}

.file-picker small {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1.3fr);
  gap: 16px;
}

.memory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}

.memory-stats div {
  min-height: 62px;
  display: grid;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.1);
  backdrop-filter: blur(14px);
}

.memory-stats strong {
  color: var(--accent-2);
  font-size: 1.35rem;
  line-height: 1;
}

.memory-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.memory-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.random-memory {
  margin: 0 0 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.72);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

.random-memory-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.random-memory-header h2 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 1.35rem;
}

.random-memory-actions {
  display: flex;
  gap: 8px;
}

.random-memory-slot .memory-card {
  max-width: 520px;
  margin: 0 auto;
}

.year-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: thin;
}

.year-filter.is-hidden {
  display: none;
}

.year-filter button {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 242, 0.08);
  color: var(--text);
  font-weight: 800;
}

.year-filter button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--ink);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.year-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.year-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 -2px;
  color: var(--text);
  font-size: 1.2rem;
}

.year-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.memory-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 18, 15, 0.82);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
}

.memory-card img,
.memory-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: #050505;
}

.memory-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.memory-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 800;
}

.heart-button,
.edit-button,
.delete-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 1rem;
}

.heart-button.is-loved {
  background: rgba(227, 93, 91, 0.22);
  color: #ff9a93;
}

.memory-actions {
  display: flex;
  gap: 8px;
}

.memory-body h2 {
  margin-bottom: 0;
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.25;
}

.memory-body p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 40px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 13, 0.64);
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 480px;
  margin: 0 auto;
  color: var(--muted);
}

@media (max-width: 700px) {
  body {
    background-attachment: scroll;
    background-size: cover;
  }

  .memory-view {
    width: calc(100% - 24px);
    max-width: 560px;
    padding: 18px 0 32px;
  }

  .login-panel,
  .composer {
    padding: 20px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px 0;
  }

  .topbar h1 {
    font-size: clamp(2.4rem, 13vw, 3.35rem);
  }

  .topbar-actions,
  .ghost-button {
    width: 100%;
  }

  .topbar-actions,
  .composer-header,
  .places-header,
  .watch-header {
    flex-direction: column;
  }

  .primary-small-button {
    width: 100%;
  }

  .subtle-button {
    width: 100%;
    min-width: 0;
  }

  .memory-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .random-memory-header,
  .random-memory-actions {
    flex-direction: column;
  }

  .random-memory-actions {
    width: 100%;
  }

  .places-view,
  .watch-view {
    padding: 16px;
  }

  .watch-form,
  .watch-columns {
    grid-template-columns: 1fr;
  }

  .turkey-map {
    padding: 8px;
  }

  .turkey-map svg {
    min-width: 0;
  }

  .love-counter {
    padding: 14px;
  }

  .counter-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .counter-grid div {
    min-height: 64px;
  }

  .counter-grid strong {
    font-size: 1.35rem;
  }

  .counter-grid span {
    font-size: 0.72rem;
  }

  .memory-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .memory-stats div {
    min-height: 54px;
    justify-items: center;
    padding: 10px 6px;
    text-align: center;
  }

  .memory-stats strong {
    font-size: 1.12rem;
  }

  .memory-stats span {
    font-size: 0.68rem;
  }

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

@media (max-width: 420px) {
  .login-view {
    padding: 16px;
  }

  .login-panel,
  .composer {
    padding: 16px;
  }

  .counter-grid,
  .memory-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .timeline {
    grid-template-columns: minmax(0, 1fr);
  }

  .year-section {
    grid-template-columns: minmax(0, 1fr);
  }

  input,
  textarea {
    font-size: 16px;
  }
}

@media (min-width: 701px) and (max-width: 980px) {
  .counter-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
