:root {
  --bg: #faf7f2;
  --panel: #fff;
  --ink: #2b2623;
  --muted: #8a817a;
  --line: #e7e0d6;
  --accent: #c2410c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1815; --panel: #25211d; --ink: #f1ebe4; --muted: #9a9088; --line: #3a342e; --accent: #fb923c; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  font: 15px/1.45 system-ui, sans-serif; background: var(--bg); color: var(--ink);
}
h1 { font-size: 1.2rem; margin: 0; flex: 1; }
h2 { margin: 0 0 .25rem; font-size: 1.25rem; }
button, input, textarea {
  font: inherit; color: inherit; background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: .45rem .7rem;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: #b91c1c; }
button.link { border: 0; background: none; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: #b91c1c; margin: 0; }

header { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
header form { margin: 0; }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr 340px; }
#timeline, #details { overflow-y: auto; background: var(--panel); padding: .75rem; }
#timeline { border-right: 1px solid var(--line); }
#details { border-left: 1px solid var(--line); }
#map { min-height: 0; z-index: 0; }

.entry {
  display: block; width: 100%; text-align: left; margin-bottom: .5rem; padding: .6rem .75rem;
}
.entry.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.entry .date { color: var(--muted); font-size: .8rem; }
.entry .name { font-weight: 600; }
.stars .off { opacity: .18; filter: grayscale(1); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .1rem .6rem; font-size: .85rem; }
.notes { white-space: pre-wrap; }
.actions { display: flex; gap: .5rem; margin-top: 1rem; }

.emoji-marker {
  position: relative; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  transform-origin: 50% 100%; transition: transform .12s;
}
.emoji-marker::after { /* pointer tail */
  content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -7px;
  border: 7px solid transparent; border-top: 9px solid var(--accent); border-bottom: 0;
}
.emoji-marker.active { transform: scale(1.3); background: var(--accent); border-color: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.emoji-marker.active::after { border-top-color: #fff; }

form.entry-form { display: flex; flex-direction: column; gap: .6rem; }
form.entry-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
form.entry-form label > * { color: var(--ink); }
.row { display: flex; gap: .4rem; }
.row > input { flex: 1; min-width: 0; }
.rating-pick button, .emoji-presets button { padding: .2rem .5rem; }
.rating-pick button.on, .emoji-presets button.on { border-color: var(--accent); background: var(--bg); }
.emoji-presets { display: flex; flex-wrap: wrap; gap: .25rem; }
.results button { display: block; width: 100%; text-align: left; margin-top: .25rem; font-size: .85rem; }
.picked { font-size: .85rem; color: var(--muted); }

body.login { align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; gap: .75rem; width: min(320px, 90vw); text-align: center; }
.login-box h1 { flex: none; font-size: 1.6rem; }

@media (max-width: 900px) {
  body { height: auto; min-height: 100%; }
  main { display: flex; flex-direction: column; }
  #map { order: 1; height: 45vh; flex: none; }
  #timeline { order: 2; border: 0; }
  #details { order: 3; border: 0; border-top: 1px solid var(--line); }
}
