:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --ink: #26231f;
  --muted: #6e675f;
  --line: #ded7cd;
  --accent: #247a63;
  --warn: #9a5a25;
  --shadow: 0 8px 30px rgba(54, 47, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(247, 244, 238, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.toolbar-title {
  min-width: 132px;
  font-size: 18px;
  font-weight: 700;
}

.page-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toolbar-spacer {
  flex: 1;
}

button,
select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.toolbar a {
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
}

.toolbar a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  padding: 0 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

select {
  padding: 0 28px 0 10px;
}

.layout {
  padding: 16px;
  min-height: 0;
}

.image-stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  background: #ede7dc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.note-wrap {
  position: relative;
  width: min(100%, 1080px);
  line-height: 0;
}

.note-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow);
  background: white;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
}

.note-hotspot {
  position: absolute;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(36, 122, 99, 0);
  cursor: pointer;
}

.note-hotspot.source-highlight {
  z-index: 1;
}

.note-hotspot.source-ocr {
  z-index: 2;
}

.note-hotspot.has-audio:hover,
.note-hotspot.has-audio:focus-visible,
.note-hotspot.has-audio.is-playing {
  background: rgba(36, 122, 99, 0.18);
  outline: 2px solid rgba(36, 122, 99, 0.75);
}

.note-hotspot.no-audio:hover,
.note-hotspot.no-audio:focus-visible {
  background: rgba(154, 90, 37, 0.16);
  outline: 2px solid rgba(154, 90, 37, 0.72);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  color: white;
  background: rgba(38, 35, 31, 0.92);
  border-radius: 7px;
  box-shadow: var(--shadow);
  z-index: 10;
}

@media (max-width: 900px) {
  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar-title {
    min-width: 0;
  }

  .page-status {
    width: 100%;
    order: 5;
  }
}
