@font-face {
  font-family: "Lexend";
  src: url("assets/fonts/Lexend-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lexend";
  src: url("assets/fonts/Lexend-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lexend";
  src: url("assets/fonts/Lexend-800.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-top: #e8f4ff;
  --bg-mid: #f8fbff;
  --panel: #ffffff;
  --text: #1d2733;
  --muted: #5f6b78;
  --line: #d6dfeb;
  --accent: #0f766e;
  --accent-dark: #0a5a54;
  --accent-soft: #e6f8f6;
  --coin-bg: #edf6ff;
  --note-bg: #fff8e8;
  --chip-bg: #f2f9ff;
  --shadow: 0 10px 32px rgba(22, 45, 78, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Lexend", "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 92% 10%, #cde6ff 0, transparent 33%),
    radial-gradient(circle at 8% 88%, #d5fff4 0, transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, #f7f9fc 100%);
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 14px 26px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: 0.2px;
}

.app-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.panel {
  background: linear-gradient(180deg, #ffffff 0%, #fefefe 100%);
  border: 2px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.setup-panel {
  max-width: 620px;
}

.setup-layout {
  display: grid;
  grid-template-columns: minmax(520px, 620px) 1fr;
  gap: 14px;
  align-items: start;
}

.setup-side-visual {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
}

.setup-side-image {
  width: 100%;
  max-width: 360px;
  height: auto;
  object-fit: contain;
}

.setup-panel h2,
.result-panel h2 {
  margin: 0 0 10px;
}

form {
  display: grid;
  gap: 12px;
}

button,
input[type="checkbox"] {
  font: inherit;
}

button {
  min-height: 50px;
  border-radius: 12px;
  border: 2px solid var(--line);
  padding: 8px 12px;
}

button {
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.inline-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-fieldset {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 0;
}

.setting-fieldset legend {
  font-weight: 800;
  padding: 0 6px;
}

.setting-fieldset.is-disabled {
  opacity: 0.65;
}

.choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  width: 100%;
}

.choice-btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  border: 2px solid #cfd8e7;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(18, 36, 61, 0.06);
}

.choice-btn.active {
  color: #ffffff;
  border-color: #0f766e;
  background: linear-gradient(180deg, #22a17e 0%, #0f766e 100%);
}

.primary {
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: var(--accent-dark);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
}

.secondary {
  color: var(--text);
  background: #ffffff;
}

.task-panel {
  display: grid;
  gap: 14px;
}

.home-btn {
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.progress-row {
  display: grid;
  gap: 8px;
}

.progress {
  font-size: 1.05rem;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.progress-segment {
  height: 12px;
  border-radius: 999px;
  background: #dbe8f7;
}

.progress-segment.current {
  background: #7fb7ff;
}

.progress-segment.correct {
  background: linear-gradient(90deg, #2dc790 0%, #0f766e 100%);
}

.progress-segment.wrong {
  background: linear-gradient(90deg, #ff7a7a 0%, #cc2f2f 100%);
}

.instruction {
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.35;
  border: 2px solid #bde8df;
  border-radius: 14px;
  background: linear-gradient(180deg, #f0fffb 0%, var(--accent-soft) 100%);
  padding: 10px 12px;
}

.roleplay-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  align-items: center;
}

.roleplay-person {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 14px;
  border: 2px solid #c8d9f1;
  background: #edf4ff;
}

.speech-bubble {
  position: relative;
  border: 2px solid #bfd4ea;
  background: #ffffff;
  border-radius: 14px;
  padding: 10px 12px;
}

.speech-bubble::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 30px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 2px solid #bfd4ea;
  border-bottom: 2px solid #bfd4ea;
  transform: rotate(45deg);
}

.speech-bubble p {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.speech-bubble p + p {
  margin-top: 6px;
}

.product-card {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: center;
  justify-content: start;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, #f8fbff 0%, #ffffff 70%);
  padding: 12px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item-list.multi {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #f9fcff;
  overflow-x: auto;
}

.item-list.multi .product-card {
  min-width: 220px;
  margin: 0;
}

.total-card {
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #f9fcff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.total-card h4 {
  margin: 0;
  font-size: 1.04rem;
}

.total-tag {
  transform: none;
}

.icon {
  width: 152px;
  height: 152px;
  border-radius: 18px;
  border: 2px solid #bcd4f0;
  background: linear-gradient(180deg, #eef6ff 0%, #e8f0ff 100%);
  display: grid;
  place-items: center;
}

.product-image {
  width: 132px;
  height: 132px;
  object-fit: contain;
  display: block;
}

.icon-fallback {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.product-meta h3,
.product-meta p {
  margin: 0;
}

.product-title-row {
  display: block;
}

.product-meta {
  display: grid;
  align-items: center;
}

.price-tag {
  min-width: 132px;
  min-height: 64px;
  border-radius: 12px;
  border: 2px solid #e5b14b;
  background: linear-gradient(180deg, #ffe9a4 0%, #ffd978 100%);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
  transform: rotate(-1.5deg);
}

.price-tag span {
  font-size: 1.2rem;
  font-weight: 900;
  color: #5f3f00;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.zones {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.zone {
  border: 2px dashed #99b4d9;
  border-radius: 14px;
  min-height: 136px;
  padding: 10px;
  background: #ffffff;
}

.zone.active {
  background: #f3f9ff;
}

.zone.muted {
  opacity: 0.72;
}

.zone h4 {
  margin: 0 0 8px;
  font-size: 1.06rem;
}

.payment-fixed {
  background: #f7fbff;
  border-style: solid;
}

.payment-fixed p {
  margin: 0;
  font-size: 1.2rem;
}

.fixed-payment-visual {
  display: grid;
  place-items: center;
  min-height: 72px;
}

.fixed-payment-img {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.drop-list {
  min-height: 54px;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.chip {
  margin: 4px 6px 4px 0;
  min-height: 56px;
  min-width: 84px;
  border-radius: 999px;
  border: 2px solid #9ec8ec;
  background: var(--chip-bg);
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  position: relative;
  padding: 3px 20px 3px 8px;
}

.chip-money-img {
  max-width: 54px;
  max-height: 42px;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.chip-value {
  font-size: 0.92rem;
}

.chip-x {
  position: absolute;
  right: 6px;
  top: 4px;
  font-size: 1rem;
  line-height: 1;
  color: #315077;
}

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

.btn-icon {
  display: inline-block;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 900;
}

.feedback {
  min-height: 26px;
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.money-tray {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.money {
  min-height: 78px;
  min-width: 88px;
  border: 2px solid #afc0d9;
  color: #1e2d3f;
  font-weight: 900;
  display: grid;
  place-items: center;
  padding: 4px;
}

.money.coin {
  min-width: 78px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, var(--coin-bg) 40%, #d6e9fb 100%);
}

.money.note {
  border-radius: 12px;
  background: linear-gradient(180deg, #fffef7 0%, var(--note-bg) 100%);
}

.money-img {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.money.note .money-img {
  max-height: 52px;
}

.money-text {
  font-size: 0.95rem;
}

.result-panel p {
  margin: 8px 0;
  font-size: 1.08rem;
}

.result-chart-wrap {
  display: grid;
  place-items: center;
  margin: 8px 0 10px;
}

.result-pie {
  --pie: 0;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: conic-gradient(#0f766e calc(var(--pie) * 1%), #f1c5c5 0);
  border: 2px solid #c9d6e8;
}

.result-pie-center {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #173049;
}

@media (max-width: 760px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .product-card {
    grid-template-columns: auto;
    justify-items: center;
    text-align: center;
  }

  .setup-layout {
    grid-template-columns: 1fr;
  }

  .setup-side-visual {
    min-height: 180px;
  }

  .total-card {
    flex-direction: column;
    text-align: center;
  }

  .item-list.multi .product-card {
    min-width: 190px;
  }

  .roleplay-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .speech-bubble::before {
    display: none;
  }

  .icon {
    width: 132px;
    height: 132px;
  }

  .product-image {
    width: 114px;
    height: 114px;
  }

  .price-tag {
    transform: none;
  }

  .actions button {
    flex: 1 1 160px;
  }
}

@media (min-width: 761px) and (max-height: 900px) and (orientation: landscape) {
  .setup-layout {
    grid-template-columns: 1fr;
  }

  .setup-side-visual {
    display: none;
  }

  .setup-panel {
    max-width: 100%;
  }

  .setup-panel h2 {
    margin-bottom: 6px;
  }

  .setup-panel form {
    gap: 8px;
  }

  .setting-fieldset {
    padding: 8px;
  }

  .setting-fieldset legend {
    font-size: 0.95rem;
  }

  .choice-row {
    gap: 6px;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .choice-btn {
    min-height: 36px;
    padding: 6px 8px;
    font-size: 0.92rem;
  }
}
