/* =========================================================
   沖縄文芸フリマ オンライン事務局
   HTML/CSS/Vanilla JS only. External assets are local only.
   ========================================================= */

:root {
  --paper: #f7efe0;
  --paper-deep: #ead9bc;
  --surface: #fff9ed;
  --ink: #34281e;
  --muted: #705f51;
  --roof: #ad4b35;
  --roof-deep: #803323;
  --sea: #1f6e78;
  --sea-deep: #174f57;
  --console: #183b3f;
  --console-line: #5fb8a7;
  --leaf: #607747;
  --gold: #c9902e;
  --line: #dbc59e;
  --shadow: 0 12px 30px rgba(52, 40, 30, 0.16);
  --radius: 12px;
  --font-head: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --font-body: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.8;
  scroll-behavior: smooth;
}

body {
  background-image:
    linear-gradient(180deg, rgba(207, 231, 228, 0.65), rgba(247, 239, 224, 0.7) 280px),
    repeating-linear-gradient(90deg, rgba(173, 75, 53, 0.05) 0 1px, transparent 1px 72px);
}

a {
  color: var(--sea);
}

a:focus-visible,
button:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

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

.site-header {
  background:
    linear-gradient(135deg, rgba(128, 51, 35, 0.94), rgba(31, 110, 120, 0.9)),
    var(--roof);
  color: #fff8ec;
  padding: 34px 20px 38px;
  border-bottom: 6px solid var(--paper-deep);
}

.header-inner,
.demo-notice,
.stage-section,
.flow-section,
.info-section,
.detail-section,
.event-info,
.contact-method,
.cta {
  width: min(100% - 32px, 980px);
  margin-inline: auto;
}

.header-inner {
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site-header h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-head);
  letter-spacing: 0.02em;
}

.h1-sub {
  font-size: clamp(1.18rem, 3.2vw, 1.7rem);
  font-weight: 600;
}

.h1-main {
  font-size: clamp(1.65rem, 5vw, 2.75rem);
}

.lead {
  margin: 14px auto 0;
  max-width: 720px;
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 700;
}

.header-copy {
  max-width: 760px;
  margin: 16px auto 0;
  font-size: 1rem;
}

.hero-actions,
.cta-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.mission-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 20px auto 0;
  max-width: 880px;
}

.mission-status span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
  border: 1px solid rgba(255, 248, 236, 0.36);
  border-radius: 8px;
  background: rgba(24, 59, 63, 0.44);
  color: #fff8ec;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.primary-link,
.back-link,
.card-button,
.cta-links a,
.office-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.primary-link,
.card-button {
  background: var(--roof);
  border: 2px solid var(--roof-deep);
  color: #fff8ec;
}

.primary-link:hover,
.card-button:hover {
  background: var(--roof-deep);
}

.back-link {
  background: rgba(255, 248, 236, 0.12);
  border: 2px solid rgba(255, 248, 236, 0.78);
  color: #fff8ec;
}

.demo-sub {
  margin: 14px 0 0;
  font-size: 1rem;
  line-height: 1.6;
  opacity: 1;
}

.demo-notice,
.flow-section,
.info-section,
.detail-section,
.event-info,
.contact-method,
.cta {
  margin-top: 28px;
  padding: 24px;
  background: rgba(255, 249, 237, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.demo-notice {
  border-left: 6px solid var(--sea);
}

.demo-notice h2,
.section-heading h2,
.cta h2 {
  margin: 0;
  color: var(--roof-deep);
  font-family: var(--font-head);
  font-size: clamp(1.35rem, 3vw, 1.95rem);
}

.demo-notice p,
.info-section p,
.event-info p,
.contact-method p,
.cta p {
  margin: 12px 0 0;
}

.section-heading {
  text-align: center;
  margin-bottom: 18px;
}

.section-kicker {
  color: var(--sea);
}

.stage-section {
  margin-top: 32px;
}

.stage-wrap {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--paper-deep);
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  overflow: hidden;
  border: 3px solid var(--roof-deep);
  background-color: #ead9bc;
  background-image:
    linear-gradient(rgba(247, 239, 224, 0.1), rgba(52, 40, 30, 0.12)),
    url("assets/office-background.png"),
    linear-gradient(135deg, #d9c092, #7fa9a1 48%, #ead9bc);
  background-size: 100% 100%, contain, cover;
  background-position: center, center, center;
  background-repeat: no-repeat;
}

.console-overlay {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(520px, calc(100% - 24px));
  padding: 8px;
  border: 1px solid rgba(95, 184, 167, 0.7);
  border-radius: 8px;
  background: rgba(24, 59, 63, 0.68);
  color: #eafff6;
  box-shadow: 0 8px 18px rgba(24, 59, 63, 0.24);
}

.console-overlay span {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid rgba(234, 255, 246, 0.24);
  border-radius: 5px;
  background: rgba(234, 255, 246, 0.08);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 249, 237, 0.08), rgba(52, 40, 30, 0.18));
  pointer-events: none;
}

.stage-fallback {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 1;
  max-width: 320px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 249, 237, 0.86);
  color: var(--ink);
  font-size: 0.82rem;
}

.spot {
  position: absolute;
  z-index: 2;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-align: center;
}

.spot span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 249, 237, 0.86);
  border: 1px solid rgba(128, 51, 35, 0.25);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.character {
  position: absolute;
  z-index: 5;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 82px;
  transition: left 1.15s ease-in-out, top 1.15s ease-in-out;
}

.dotfig {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  box-shadow: 0 4px 0 rgba(52, 40, 30, 0.28);
}

.dotfig .eye {
  position: absolute;
  top: 12px;
  left: 9px;
  width: 4px;
  height: 4px;
  background: var(--ink);
  border-radius: 50%;
}

.dotfig .eye2 {
  left: 20px;
}

.dotfig.guide { background: var(--sea); }
.dotfig.entry { background: var(--roof); }
.dotfig.works { background: var(--gold); }
.dotfig.public { background: #c46a9b; }
.dotfig.volunteer { background: var(--leaf); }

.char-label {
  margin: 5px 0 0;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 249, 237, 0.9);
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.bubble {
  position: absolute;
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  transform-origin: bottom center;
  width: max-content;
  max-width: 230px;
  min-height: 26px;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  text-align: left;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 12px;
  height: 12px;
  background: #fffdf7;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateX(-50%) rotate(45deg);
}

.character.show-bubble .bubble {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.character.working .dotfig { animation: bob 0.9s ease-in-out infinite; }
.character.walking .dotfig { animation: bob 0.35s ease-in-out infinite; }
.character.waving .dotfig { animation: wave 0.6s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}

.office-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.office-menu a {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--sea-deep);
  border-radius: 10px;
}

.office-menu a:hover {
  border-color: var(--sea);
  background: #eef7f4;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 12px;
}

.controls button {
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid var(--roof-deep);
  border-radius: 999px;
  background: var(--roof);
  color: #fff8ec;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.controls button:hover {
  background: var(--roof-deep);
}

#btn-restart {
  background: var(--surface);
  color: var(--roof-deep);
}

#btn-restart:hover {
  background: var(--paper-deep);
}

#btn-stop {
  background: var(--sea);
  border-color: var(--sea-deep);
}

#btn-stop:hover {
  background: var(--sea-deep);
}

.controls button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.now-playing {
  min-height: 1.8em;
  margin: 0 0 18px;
  text-align: center;
  color: var(--roof-deep);
  font-weight: 700;
}

.progress {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.progress li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
}

.progress li .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.55;
}

.progress li.active {
  border-color: var(--console-line);
  color: var(--console);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(95, 184, 167, 0.26);
}

.progress li.active .dot {
  background: var(--console-line);
  opacity: 1;
}

.progress li.done {
  color: var(--leaf);
  font-weight: 700;
}

.progress li.done .dot {
  background: var(--leaf);
  opacity: 1;
}

.progress li.done::after {
  content: "済";
  margin-left: 2px;
  font-size: 0.75rem;
}

.mission-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.mission-board > div {
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(95, 184, 167, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(24, 59, 63, 0.95), rgba(31, 110, 120, 0.88)),
    var(--console);
  color: #f5fff9;
}

.mission-board strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.mission-board p {
  margin: 6px 0 0;
  color: rgba(245, 255, 249, 0.86);
  font-size: 0.9rem;
  line-height: 1.65;
}

.board-label {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid rgba(245, 255, 249, 0.24);
  border-radius: 5px;
  color: var(--console-line);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.noscript-note {
  margin: 18px auto 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.status-note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--sea);
  background: #eef7f4;
  color: var(--sea-deep);
  font-weight: 700;
}

.flow-list {
  counter-reset: flow;
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 18px 0;
}

.flow-list li {
  counter-increment: flow;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.flow-list li::before {
  content: counter(flow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--roof);
  color: #fff8ec;
  font-weight: 700;
}

.example-panel {
  margin: 18px 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(234, 217, 188, 0.45);
}

.example-panel h3 {
  margin: 0 0 12px;
  color: var(--roof-deep);
  font-family: var(--font-head);
}

.tag-list,
.contact-topics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.tag-list li,
.contact-topics li {
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.info-section,
.detail-section,
.event-info,
.contact-method,
.cta {
  max-width: 760px;
}

.detail-section {
  max-width: 980px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.detail-card h3 {
  margin: 0 0 8px;
  color: var(--roof-deep);
  font-family: var(--font-head);
  font-size: 1.05rem;
}

.detail-card p {
  margin: 0;
}

.event-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
  padding: 0;
}

.event-facts > div {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.event-facts dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.event-facts dd {
  margin: 0;
  color: var(--roof-deep);
  font-weight: 700;
}

.contact-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 16px 0 0;
}

.contact-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.contact-list a {
  font-weight: 700;
}

.cta {
  text-align: center;
  margin-bottom: 36px;
}

.cta-links a {
  background: var(--sea);
  border: 2px solid var(--sea-deep);
  color: #fff8ec;
}

.cta-links a:hover {
  background: var(--sea-deep);
}

.site-footer {
  padding: 18px 12px 34px;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

@media (max-width: 820px) {
  .office-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mission-status,
  .mission-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-facts {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .site-header {
    padding-top: 28px;
  }

  .header-inner,
  .demo-notice,
  .stage-section,
  .flow-section,
  .info-section,
  .detail-section,
  .event-info,
  .contact-method,
  .cta {
    width: min(100% - 24px, 980px);
  }

  .hero-actions,
  .cta-links {
    flex-direction: column;
  }

  .mission-status,
  .mission-board {
    grid-template-columns: 1fr;
  }

  .primary-link,
  .back-link,
  .card-button,
  .cta-links a {
    width: 100%;
  }

  .stage {
    aspect-ratio: 16 / 11;
    min-height: 340px;
    background-size: 100% 100%, contain, cover;
  }

  .console-overlay {
    top: 8px;
    left: 8px;
    right: 8px;
    max-width: none;
    padding: 6px;
  }

  .console-overlay span {
    min-height: 26px;
    font-size: 0.78rem;
  }

  .spot-entry,
  .spot-works,
  .spot-guide,
  .spot-public,
  .spot-volunteer {
    display: none;
  }

  .spot span {
    font-size: 0.7rem;
    padding: 3px 6px;
  }

  .character {
    width: 66px;
  }

  .dotfig {
    width: 28px;
    height: 28px;
  }

  .dotfig .eye {
    top: 10px;
    left: 7px;
  }

  .dotfig .eye2 {
    left: 17px;
  }

  .char-label {
    display: none;
  }

  .bubble {
    bottom: 48px;
    max-width: 220px;
    padding: 7px 9px;
    font-size: 0.85rem;
  }

  .office-menu {
    grid-template-columns: 1fr;
  }

  .flow-list li {
    grid-template-columns: 34px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html,
  body {
    scroll-behavior: auto;
  }

  .character {
    transition: none;
  }

  .character.working .dotfig,
  .character.walking .dotfig,
  .character.waving .dotfig {
    animation: none;
  }

  .bubble {
    transition: none;
  }
}
