:root {
  --bg: #f3f5f0;
  --ink: #18231f;
  --muted: #63736d;
  --line: #dce3dc;
  --panel: #ffffff;
  --deep: #10231e;
  --accent: #e96845;
  --gold: #d7a83f;
  --green: #2f735e;
  --soft: #edf5f0;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  border: 1px solid var(--deep);
  border-radius: 8px;
  background: var(--deep);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button {
  min-height: 42px;
  padding: 0 16px;
}

button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

button:disabled {
  cursor: default;
  opacity: .58;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 112px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  letter-spacing: 0;
}

.brand-tagline {
  margin: 2px 0 0;
  color: #a9462d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.brand-tagline.big {
  margin: 8px 0 14px;
  color: var(--accent);
  font-size: 22px;
}

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

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a,
.wide-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.main-nav a.active,
.wide-link {
  border-color: var(--deep);
  background: var(--deep);
  color: #fff;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-block form {
  margin: 0;
  display: none;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.logout-link:hover {
  text-decoration: underline;
}

.wide-button {
  width: 100%;
  margin-bottom: 14px;
}

.login-page {
  min-height: 100vh;
  background: #10231e;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(320px, 560px);
  gap: 18px;
  align-items: stretch;
  min-height: 100vh;
  padding: 24px;
}

.login-hero,
.login-forms article {
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f6f3ea;
}

.login-hero img {
  width: 100%;
  max-width: 420px;
  border-radius: 8px;
  margin-bottom: 22px;
}

.login-hero h1 {
  font-size: 48px;
}

.login-hero p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-forms {
  display: grid;
  gap: 18px;
}

.login-forms h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.login-forms form {
  display: grid;
  gap: 12px;
}

.login-forms label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-forms input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.form-error {
  margin: 0;
  border: 1px solid #e6b5a6;
  border-radius: 8px;
  background: #fff4f0;
  color: #9c3d24;
  padding: 10px 12px;
  font-weight: 800;
}

.arena-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
}

.challenge-panel,
.conversation-panel,
.side-panel,
.panel-block {
  min-width: 0;
}

.challenge-panel,
.conversation-panel,
.panel-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.side-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.section-heading span,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f6;
}

.segmented button {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--deep);
  color: #fff;
}

.field-label {
  display: block;
  margin-bottom: 6px;
}

select {
  width: 100%;
  min-height: 42px;
  margin-bottom: 14px;
  padding: 0 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.floor-mini {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #ead8a8;
  border-radius: 8px;
  background: #fff8e4;
}

.floor-mini strong {
  color: var(--deep);
}

.floor-mini span {
  color: #8a6520;
  font-size: 12px;
  font-weight: 900;
}

.scenario-tiles {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.scenario-tile {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  width: 100%;
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.scenario-tile.active {
  border-color: var(--deep);
  box-shadow: 0 0 0 3px rgba(16, 35, 30, .08);
}

.scenario-avatar {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.scenario-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.scenario-tile strong {
  font-size: 17px;
}

.scenario-tile small {
  color: var(--muted);
  line-height: 1.45;
}

.scenario-tile em {
  grid-column: 2;
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
}

.customer-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.customer-card h3 {
  margin: 8px 0 0;
  font-size: 19px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.score-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.score-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-head strong {
  color: var(--accent);
  font-size: 34px;
}

.score-bars {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  gap: 5px;
}

.score-row header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebe5;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold), var(--accent));
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(430px, calc(100vh - 280px)) auto auto;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.message {
  display: grid;
  gap: 5px;
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 13px;
}

.message.customer {
  border-color: #cfe0da;
  background: #f7fbf9;
}

.message.sales {
  margin-left: auto;
  border-color: #e2d3bf;
  background: #fff8ee;
}

.message span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  margin-top: 12px;
}

textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  line-height: 1.55;
}

.status-line {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.leaderboard,
.insights {
  display: grid;
  gap: 8px;
}

.rank-row,
.insight-row {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  font-size: 13px;
}

.rank-row header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.rank-row p,
.insight-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.json-box {
  min-height: 210px;
  max-height: 380px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17201d;
  color: #edf6f0;
  padding: 12px;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.page-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.page-hero,
.ranking-toolbar,
.leader-panel,
.award-panel,
.match-console,
.match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.page-hero h2 {
  margin-bottom: 8px;
  font-size: 34px;
}

.page-hero p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.ranking-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs button {
  min-height: 38px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.tabs button.active {
  border-color: var(--deep);
  background: var(--deep);
  color: #fff;
}

.category-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
}

.podium-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.14fr minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.podium-card {
  min-height: 164px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.podium-card.first {
  min-height: 218px;
  border-color: #ead8a8;
  background: #fff8e4;
}

.podium-card span,
.ranking-row .place,
.award-row .place {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--deep);
  color: #fff;
  font-weight: 900;
}

.podium-card.first span {
  background: var(--gold);
  color: #2e2610;
}

.podium-card strong {
  display: block;
  margin-top: 12px;
  font-size: 20px;
}

.podium-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 900;
}

.ranking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.ranking-rows,
.award-rows,
.match-lanes {
  display: grid;
  gap: 10px;
}

.ranking-row,
.award-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.ranking-row h3,
.award-row h3 {
  margin-bottom: 2px;
  font-size: 16px;
}

.ranking-row p,
.award-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.ranking-row strong {
  color: var(--accent);
  font-size: 24px;
}

.match-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  align-items: start;
}

.match-card {
  cursor: pointer;
}

.match-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 104, 69, .12);
}

.match-number,
.talk-card span,
.match-scoreboard span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.match-card h2 {
  margin: 8px 0;
}

.match-card p {
  color: var(--muted);
  line-height: 1.65;
}

.match-console {
  position: sticky;
  top: 96px;
}

.talk-card {
  margin-bottom: 14px;
  border-left: 4px solid var(--accent);
  background: #fff7f3;
  padding: 14px;
}

.talk-card p {
  margin-bottom: 0;
  line-height: 1.65;
}

.match-scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.match-scoreboard div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.match-scoreboard strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

@media (max-width: 1180px) {
  .arena-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .side-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar,
  .brand-block,
  .top-actions,
  .user-block,
  .main-nav,
  .login-shell {
    align-items: stretch;
    flex-direction: column;
  }

  .login-shell {
    display: flex;
  }

  .arena-shell,
  .side-panel,
  .page-hero,
  .ranking-layout,
  .podium-section,
  .match-layout {
    grid-template-columns: 1fr;
  }

  .match-console {
    position: static;
  }

  .conversation-panel {
    grid-template-rows: auto minmax(360px, 55vh) auto auto;
  }

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

  .message {
    max-width: 100%;
  }
}
