:root {
  color-scheme: dark;
  --bg: #121416;
  --panel: #1b2024;
  --panel-strong: #232a30;
  --line: #343d45;
  --text: #f3f0e9;
  --muted: #aaa39a;
  --gold: #d9aa4f;
  --red: #b94f4d;
  --blue: #4f8fb9;
  --green: #69a96d;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(18, 20, 22, 0.86), rgba(18, 20, 22, 0.94)),
    url("https://images.unsplash.com/photo-1518709268805-4e9042af2176?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.compare-panel,
.result-panel,
.item-card {
  background: rgba(27, 32, 36, 0.94);
  border: 1px solid rgba(217, 170, 79, 0.25);
  box-shadow: var(--shadow);
}

.compare-panel {
  padding: 24px;
}

.result-panel {
  padding: 22px;
  align-self: start;
  position: sticky;
  top: 28px;
}

.topbar,
.item-heading,
.actions,
.legend {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
  color: var(--gold);
}

.controls-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.item-card {
  padding: 18px;
}

.item-card[data-side="equipped"] {
  border-color: rgba(79, 143, 185, 0.55);
}

.item-card[data-side="chest"] {
  border-color: rgba(185, 79, 77, 0.55);
}

.item-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.score-pill {
  min-width: 86px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--gold);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #111518;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 170, 79, 0.14);
}

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

.stat-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 38px;
  gap: 8px;
  align-items: center;
}

button {
  min-height: 40px;
  border: 1px solid rgba(217, 170, 79, 0.6);
  border-radius: 2px;
  background: #2b2115;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  border-color: var(--gold);
  background: #3a2a18;
}

.secondary-button {
  padding: 0 14px;
}

.add-button {
  width: 100%;
}

.icon-button {
  min-width: 38px;
  padding: 0;
  background: #251719;
  border-color: rgba(185, 79, 77, 0.7);
}

.winner-block {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.winner-block h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
}

.winner-block p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-panel section {
  margin-top: 20px;
}

.meter {
  display: flex;
  height: 14px;
  overflow: hidden;
  background: #101316;
  border: 1px solid var(--line);
}

.meter span {
  display: block;
  min-width: 0;
  transition: width 160ms ease;
}

.meter span:first-child {
  background: var(--blue);
}

.meter span:last-child {
  background: var(--red);
}

.legend {
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
}

.legend-equipped {
  background: var(--blue);
}

.legend-chest {
  background: var(--red);
}

.difference-list,
.weight-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.source-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
}

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

.difference-list strong {
  color: var(--text);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .compare-panel,
  .result-panel,
  .item-card {
    padding: 16px;
  }

  .topbar,
  .items-grid,
  .controls-row,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }
}
