:root {
  color-scheme: light;
  --ink: #18202b;
  --muted: #637083;
  --line: #d9dee7;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --mint: #3aa981;
  --mint-dark: #16765a;
  --coral: #df6558;
  --sun: #f2bd45;
  --violet: #7761c8;
  --shadow: 0 18px 45px rgba(27, 37, 52, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(58, 169, 129, 0.12), transparent 32%),
    linear-gradient(225deg, rgba(223, 101, 88, 0.12), transparent 32%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 390px);
  gap: 24px;
  align-items: stretch;
  min-height: 210px;
  padding: 28px;
  border: 1px solid rgba(24, 32, 43, 0.08);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.title-block {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.kicker,
.label {
  margin: 0 0 8px;
  color: var(--mint-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(2.2rem, 8vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.champion {
  position: relative;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-width: 0;
  padding: 18px;
  border-radius: 8px;
  background: #202832;
  color: #fff;
  overflow: hidden;
}

.champion-art {
  width: 102px;
  height: 102px;
  object-fit: contain;
}

.champion strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 2rem;
  line-height: 1.05;
}

.champion div > span {
  display: block;
  margin-top: 8px;
  color: #d8e0ea;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin: 22px 0;
}

.friend-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.form-row {
  display: flex;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(58, 169, 129, 0.18);
}

.primary-button,
.quote-button,
.text-button,
.icon-button,
.round-button {
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 10px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 800;
}

.icon-button.small {
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
}

.icon-button.danger {
  color: var(--coral);
}

.friend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.friend-card {
  display: flex;
  min-height: 224px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(24, 32, 43, 0.1);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(27, 37, 52, 0.08);
}

.friend-card:nth-child(3n + 1) {
  border-top: 6px solid var(--mint);
}

.friend-card:nth-child(3n + 2) {
  border-top: 6px solid var(--coral);
}

.friend-card:nth-child(3n + 3) {
  border-top: 6px solid var(--violet);
}

.friend-card.daniel-dark-card {
  border-color: rgba(255, 255, 255, 0.12);
  border-top-color: #8b9cff;
  background: #111722;
  color: #eef2ff;
  box-shadow: 0 18px 44px rgba(10, 14, 22, 0.36);
}

.friend-card.daniel-dark-card .friend-header p,
.friend-card.daniel-dark-card .discord-id-form label {
  color: #aeb8d2;
}

.friend-card.daniel-dark-card input {
  border-color: rgba(255, 255, 255, 0.18);
  background: #1b2433;
  color: #f7f8ff;
}

.friend-card.daniel-dark-card input::placeholder {
  color: #7f8aa3;
}

.friend-card.daniel-dark-card .round-button,
.friend-card.daniel-dark-card .save-id-button,
.friend-card.daniel-dark-card .icon-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: #273245;
  color: #eef2ff;
}

.friend-card.daniel-dark-card .plus-button,
.friend-card.daniel-dark-card .discord-button {
  background: #8b9cff;
  color: #101522;
}

.friend-card.daniel-dark-card .quote-button {
  background: #f2bd45;
  color: #141820;
}

.friend-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.friend-header h2 {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
  line-height: 1.15;
}

.friend-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.counter-row {
  display: grid;
  grid-template-columns: 46px minmax(64px, 1fr) 46px;
  gap: 12px;
  align-items: center;
  margin: 24px 0 14px;
}

.round-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #edf2f0;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 900;
}

.plus-button {
  background: var(--mint);
  color: #fff;
}

.count {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  font-size: 3rem;
  line-height: 1;
  text-overflow: ellipsis;
}

.discord-id-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}

.discord-id-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.discord-id-input {
  min-height: 38px;
  padding: 0 10px;
  font-size: 0.92rem;
}

.save-id-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  background: #edf2f0;
  color: var(--mint-dark);
  font-weight: 900;
  white-space: nowrap;
}

.quote-button,
.discord-button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  background: #202832;
  color: #fff;
  font-weight: 800;
}

.discord-button {
  margin-top: 10px;
  background: #5865f2;
}

.discord-button:disabled {
  cursor: not-allowed;
  background: #aeb5cf;
  color: #f7f8fb;
  transform: none;
}

.history-band {
  margin-top: 28px;
  padding: 4px 0 0;
}

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

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.text-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--coral);
  font-weight: 800;
}

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

.history-list li {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border-left: 5px solid var(--sun);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.78);
  overflow-wrap: anywhere;
}

.history-list time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}

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

button:active {
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1120px);
    padding-top: 14px;
  }

  .scoreboard,
  .controls {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    padding: 20px;
  }

  .champion {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .champion-art {
    width: 76px;
    height: 76px;
  }

  .form-row {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-end;
  }

  .discord-id-form {
    grid-template-columns: 1fr;
  }
}
