* {
  box-sizing: border-box;
}

:root {
  --bg: #e8e2d5;
  --card: #f8f4e9;
  --ink: #292722;
  --muted: #746f63;
  --primary: #9b4b32;
  --primary-dark: #713522;
  --accent: #b4873d;
  --line: #cec5b3;
  --green: #4c7256;
  --red: #a74b3b;
  --shadow: 0 16px 36px rgba(66, 55, 37, .14);
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: linear-gradient(rgba(78, 65, 45, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(78, 65, 45, .035) 1px, transparent 1px);
  background-size: 22px 22px;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.screen {
  width: min(900px, 100%);
  min-height: 680px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 36px;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.start-screen,
.result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.title-animal {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 88px;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--primary);
  border-bottom: 1px solid var(--accent);
  padding: 0 18px 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1, h2 {
  margin: 0;
  letter-spacing: .04em;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
}

h1 {
  font-size: clamp(40px, 7vw, 64px);
}

h2 {
  font-size: 25px;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  margin: 10px 0 24px;
}

.rule-card {
  width: min(440px, 100%);
  padding: 16px 20px;
  border-radius: 2px;
  background: #f1ecdf;
  border: 1px solid var(--line);
  text-align: left;
  line-height: 2;
  color: #52647c;
  font-size: 14px;
}

.primary-button,
.secondary-button,
.small-button {
  border: 0;
  border-radius: 2px;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.primary-button {
  margin-top: 25px;
  padding: 16px 44px;
  color: white;
  background: var(--primary);
  box-shadow: 4px 4px 0 rgba(113,53,34,.16);
  font-size: 17px;
}

.primary-button:hover,
.secondary-button:hover,
.small-button:hover {
  transform: translateY(-2px);
}

.best-score {
  margin-top: 18px;
  color: #8795a8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}

.game-screen {
  min-height: 760px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.small-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 9px 15px;
  font-size: 13px;
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 70px;
  margin: 20px 0 12px;
}

.status-bar div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.status-bar span {
  color: var(--muted);
  font-size: 13px;
}

.status-bar strong {
  font-size: 23px;
  min-width: 34px;
  text-align: right;
}

.status-bar small {
  color: var(--muted);
}

.animal-card {
  text-align: center;
}

.animal-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.animal-icon {
  font-size: 78px;
  line-height: 1.15;
  filter: grayscale(.2) sepia(.15);
}

.pan-animal {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  font-size: 46px;
  line-height: 1;
  filter: grayscale(.2) sepia(.15) drop-shadow(0 4px 3px rgba(66,55,37,.18));
}

.hint {
  color: #8390a2;
  font-size: 13px;
}

.scale-area {
  position: relative;
  margin: 10px auto 0;
  width: min(700px, 100%);
}

.scale-readout {
  display: flex;
  justify-content: space-between;
  padding: 0 80px;
  color: #66778d;
  font-size: 12px;
  font-weight: 700;
}

.scale {
  position: relative;
  width: 100%;
  height: 230px;
}

.beam {
  position: absolute;
  width: 76%;
  height: 18px;
  left: 12%;
  top: 83px;
  transform-origin: 50% 50%;
  transition: transform .35s cubic-bezier(.2,.7,.3,1);
  z-index: 5;
}

.beam::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(#74624b, #554836);
  box-shadow: 0 4px 8px rgba(66,55,37,.18);
}

.pan {
  position: absolute;
  top: 12px;
  width: 31%;
  height: 95px;
}

.left-pan { left: 0; }
.right-pan { right: 0; }

.pan-bowl {
  position: absolute;
  width: 100%;
  height: 45px;
  top: 38px;
  border: 4px solid #85745b;
  border-top: 0;
  border-radius: 0 0 50% 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,.5), rgba(235,228,213,.95));
  box-shadow: 0 6px 7px rgba(66,55,37,.12);
}

.pan::before,
.pan::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 45px;
  background: #85745b;
  top: 0;
}

.pan::before { left: 17%; transform: rotate(8deg); }
.pan::after { right: 17%; transform: rotate(-8deg); }

.pan-weight-total {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 3;
  color: #495c74;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 2px 8px;
}

.placed-list {
  position: absolute;
  top: 2px;
  left: 10%;
  width: 80%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  z-index: 2;
}

.placed-weight {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f4b63f;
  color: white;
  border: 2px solid #d89a24;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  cursor: grab;
  box-shadow: 0 3px 6px rgba(120,80,0,.18);
  touch-action: none;
}

.support {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 43px solid transparent;
  border-right: 43px solid transparent;
  border-bottom: 105px solid #74624b;
  left: calc(50% - 43px);
  top: 92px;
  z-index: 4;
}

.pivot {
  position: absolute;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #4f4030;
  border: 5px solid #d9cdb7;
  left: calc(50% - 12.5px);
  top: 76px;
  z-index: 7;
}

.scale-shadow {
  position: absolute;
  width: 300px;
  height: 18px;
  border-radius: 50%;
  background: rgba(80,100,120,.10);
  left: calc(50% - 150px);
  bottom: 17px;
}

.scale-message {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 2px;
  background: #ebe4d5;
  color: #6c604d;
  font-size: 12px;
  font-weight: 700;
  transition: all .25s;
}

.scale-message.success {
  background: #e8f7ee;
  color: var(--green);
}

.weights-section {
  margin: 12px auto 0;
  width: min(650px, 100%);
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.section-title span {
  font-weight: 900;
}

.section-title small {
  color: #8b98a8;
  font-size: 11px;
}

.weight-tray {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
}

.weight {
  min-height: 62px;
  border-radius: 2px;
  border: 2px solid #e1c176;
  background: #d0a153;
  color: #74520f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 3px 3px 0 rgba(100,70,25,.14);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.weight:active {
  cursor: grabbing;
  transform: scale(.96);
}

.mobile-help {
  text-align: center;
  color: #98a4b3;
  font-size: 11px;
  margin-top: 9px;
}

.clear-badge {
  font-size: 25px;
  font-weight: 900;
  color: var(--green);
  margin-bottom: 20px;
}

.result-animal {
  font-size: 42px;
  font-weight: 900;
  margin-bottom: 22px;
}

.result-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  background: #f8fbfe;
  border-radius: 20px;
  padding: 10px 22px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #e3ebf3;
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row span {
  color: var(--muted);
}

.result-row strong {
  color: var(--ink);
}

.score-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .18em;
  font-weight: 900;
  margin-top: 23px;
}

.score {
  font-size: 62px;
  line-height: 1.05;
  font-weight: 1000;
  color: #2f6fc9;
}

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

.secondary-button {
  margin-top: 25px;
  padding: 16px 28px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.drag-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  margin-top: -32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f4b63f;
  color: white;
  border: 3px solid #d89a24;
  font-weight: 1000;
  box-shadow: 0 12px 25px rgba(100,70,0,.25);
}

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

@media (max-width: 700px) {
  .app { padding: 10px; align-items: stretch; }
  .screen {
    min-height: calc(100vh - 20px);
    padding: 22px 16px;
    border-radius: 22px;
  }
  .game-screen { min-height: calc(100vh - 20px); }
  .status-bar { gap: 45px; }
  .animal-icon { font-size: 66px; }
  .scale { height: 205px; }
  .scale-readout { padding: 0 28px; }
  .beam { width: 88%; left: 6%; top: 72px; }
  .support { top: 81px; }
  .pivot { top: 65px; }
  .pan { height: 85px; }
  .pan-bowl { height: 38px; top: 35px; }
  .weight-tray { grid-template-columns: repeat(3, 1fr); }
  .weight { min-height: 57px; }
  .section-title small { display: none; }
  .result-actions { flex-direction: column; width: min(330px, 100%); }
  .secondary-button { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}


/* Exhibition-oriented additions */
.exhibition-badge {
  display: inline-block;
  margin: 0 0 18px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff2cf;
  color: #9a6a10;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.range-panel {
  width: min(560px, 100%);
  margin: 14px auto 4px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #eee8dc;
  box-shadow: 3px 3px 0 rgba(66,55,37,.08);
}

.range-title {
  text-align: center;
  font-size: 12px;
  color: #687b91;
  font-weight: 900;
  margin-bottom: 8px;
}

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

.range-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 5px;
  border-radius: 2px;
  background: #f8f4e9;
  border: 1px solid #d8cfbf;
}

.range-animal {
  font-size: 11px;
  color: #687b91;
}

.range-item strong {
  font-size: 14px;
  color: #263951;
}

.range-note {
  margin-top: 8px;
  color: #8a98a8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
}

.exhibition-note {
  margin-top: 7px;
  text-align: center;
  color: #8a98a8;
  font-size: 11px;
  font-weight: 700;
}

.score-rule-box {
  width: min(430px, 100%);
  margin-top: 18px;
  padding: 12px 14px;
  background: #f3efe6;
  border: 1px solid var(--line);
  border-radius: 2px;
  text-align: left;
}

.score-rule-title {
  color: #697a8f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.score-rule-list {
  margin: 0;
  padding-left: 1.3em;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.7;
}

.game-screen .animal-card {
  margin-top: 2px;
}

.game-screen .animal-icon {
  font-size: 72px;
}

.game-screen .scale-readout {
  font-weight: 800;
}

.result-screen {
  background:
    radial-gradient(circle at 50% 20%, rgba(255,241,191,.7), transparent 32%),
    rgba(255,255,255,.9);
}

.result-screen::before,
.result-screen::after {
  content: "✦";
  position: absolute;
  color: #f4b63f;
  font-size: 30px;
  opacity: .65;
}

.result-screen::before { top: 90px; left: 17%; }
.result-screen::after { top: 150px; right: 17%; }

@media (max-width: 700px) {
  .range-list {
    gap: 5px;
  }
  .range-item strong {
    font-size: 12px;
  }
  .range-animal {
    font-size: 10px;
  }
}
