* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #fdf3df;
  background:
    linear-gradient(180deg, #063544 0%, #0d5a6c 42%, #0a3f4c 100%);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px clamp(18px, 4vw, 48px) 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(252, 221, 158, 0.2), transparent 32%),
    linear-gradient(135deg, #052b38, #0b7186 58%, #16839a);
  color: #fff7e8;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: #d9c7ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.picker-wrap,
.import-wrap,
.market-wrap,
.app-shell {
  padding-left: clamp(18px, 4vw, 48px);
  padding-right: clamp(18px, 4vw, 48px);
}

.picker-wrap {
  background: #083c4c;
  color: #fff7e8;
  box-shadow: 0 12px 28px rgba(11, 37, 49, 0.16);
}

.import-wrap {
  background: #0a4657;
  color: #fff7e8;
  border-top: 1px solid rgba(255, 247, 232, 0.14);
  border-bottom: 1px solid rgba(255, 247, 232, 0.16);
}

.market-wrap {
  padding-top: 18px;
  padding-bottom: 18px;
  background: #3f2670;
  color: #f8f2ff;
  border-bottom: 1px solid rgba(217, 199, 255, 0.3);
}

.picker-bar {
  display: flex;
  align-items: start;
  gap: 14px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 0;
}

.picker-drawer {
  flex: 1;
}

.picker-drawer summary,
.import-drawer summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  min-height: 44px;
  border: 1px solid rgba(255, 247, 232, 0.45);
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.picker-drawer summary::-webkit-details-marker,
.import-drawer summary::-webkit-details-marker {
  display: none;
}

.import-drawer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 0;
}

.market-panel {
  display: grid;
  gap: 14px;
  max-width: 1240px;
  margin: 0 auto;
}

.market-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.market-heading .eyebrow {
  color: #d9c7ff;
}

.market-controls {
  display: grid;
  grid-template-columns: minmax(130px, 160px) minmax(260px, 360px);
  gap: 10px;
  align-items: end;
}

.market-picker,
.store-picker {
  min-width: 0;
}

.market-wrap select {
  border-color: #cdb8ff;
  background: #f6f0ff;
  color: #1c103d;
}

.market-status {
  color: #eee4ff;
  font-size: 0.9rem;
  line-height: 1.4;
}

.market-status a {
  color: #f0dcff;
  font-weight: 900;
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
}

.trend-card,
.store-offer {
  border: 1px solid rgba(185, 144, 255, 0.46);
  border-radius: 8px;
  padding: 14px;
  background: #f6f0ff;
}

.trend-card {
  display: grid;
  gap: 6px;
  min-height: 100%;
}

.trend-card.is-live {
  border-color: rgba(185, 144, 255, 0.68);
  background: #efe6ff;
}

.trend-card span,
.store-offer small {
  color: #4b3c68;
  line-height: 1.35;
}

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

.store-offer {
  display: grid;
  gap: 6px;
  color: #1c103d;
  text-decoration: none;
}

.store-offer span {
  color: #5d35a8;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.store-offer strong {
  font-size: 1.2rem;
}

.menu-lines {
  display: grid;
  gap: 4px;
  width: 20px;
}

.menu-lines span {
  display: block;
  height: 2px;
  border-radius: 99px;
  background: #fff7e8;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 20px;
  padding-top: 24px;
  padding-bottom: 40px;
}

.app-shell.has-single-suggestion {
  grid-template-columns: minmax(0, 980px);
  justify-content: center;
}

.app-shell.has-single-suggestion .saved-panel {
  position: static;
  width: min(100%, 780px);
  justify-self: center;
}

.results-panel,
.saved-panel {
  min-width: 0;
}

.saved-panel {
  align-self: start;
  position: sticky;
  top: 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #88b8bf;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff2d8;
  color: #0b2531;
}

input,
textarea {
  width: 100%;
  border: 1px solid #88b8bf;
  border-radius: 6px;
  background: #fff2d8;
  color: #0b2531;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
}

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

.import-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 247, 232, 0.22);
  border-radius: 8px;
  padding: 14px;
  background: #083c4c;
}

.inline-actions {
  display: flex;
  gap: 8px;
}

.inline-actions input {
  min-width: 0;
}

.helper-text,
.import-status,
.owned-note,
.trend-note {
  color: #d4ecec;
  font-size: 0.84rem;
  line-height: 1.35;
}

.import-status {
  min-height: 22px;
  margin-top: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  accent-color: #b990ff;
}

.owned-note {
  color: #eadfff;
  font-weight: 900;
}

.trend-note {
  color: #bff3ee;
  font-weight: 900;
}

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

.muted {
  color: #d4ecec;
  font-size: 0.9rem;
}

.picked-game {
  min-height: 24px;
  margin-bottom: 12px;
  color: #eadfff;
  font-size: 1.02rem;
  font-weight: 900;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.results-grid.is-start {
  grid-template-columns: minmax(0, 1fr);
}

.results-grid.is-single-suggestion {
  grid-template-columns: minmax(0, 780px);
  justify-content: center;
}

.suggestion-start {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px solid rgba(229, 246, 245, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: #0b4858;
}

.suggestion-main-button {
  width: 100%;
  max-width: 420px;
  min-height: 64px;
  padding: 0 18px;
  white-space: normal;
}

.suggestion-layout {
  display: grid;
  gap: 12px;
  scroll-margin-top: 14px;
}

.suggestion-actions-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.suggestion-actions-top .primary-button,
.suggestion-actions-top .ghost-button {
  min-height: 52px;
}

.game-card {
  display: grid;
  gap: 14px;
  min-height: 360px;
  border: 1px solid rgba(229, 246, 245, 0.22);
  border-radius: 8px;
  padding: 14px;
  background: #0b4858;
  color: #fff7e8;
  box-shadow: 0 18px 36px rgba(4, 24, 31, 0.24);
}

.game-card.is-picked {
  border-color: #b990ff;
  box-shadow:
    0 0 0 3px rgba(185, 144, 255, 0.38),
    0 22px 44px rgba(4, 24, 31, 0.32);
}

.cover-art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 8 / 3;
  border-radius: 6px;
  background: #0e5366;
}

.cover-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-art.is-placeholder {
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(185, 144, 255, 0.28), rgba(14, 83, 102, 0.78));
}

.cover-art.is-placeholder::before {
  content: attr(data-title);
  max-width: 88%;
  color: #fff7e8;
  font-size: clamp(1rem, 3vw, 1.8rem);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
}

.cover-art.is-placeholder img,
.cover-art.is-placeholder span {
  display: none;
}

.cover-art span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 999px;
  padding: 5px 9px;
  color: #fffdf8;
  background: rgba(7, 28, 37, 0.78);
  font-size: 0.72rem;
  font-weight: 900;
}

.game-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.score-pill {
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  background: #b990ff;
  color: #160b2f;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: help;
  outline-offset: 3px;
}

.score-pill::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  width: min(280px, 76vw);
  border: 1px solid rgba(217, 199, 255, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  background: #1c103d;
  color: #f8f2ff;
  box-shadow: 0 16px 28px rgba(4, 24, 31, 0.32);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.score-pill:hover::after,
.score-pill:focus::after,
.score-pill:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid rgba(255, 247, 232, 0.3);
  border-radius: 999px;
  padding: 5px 8px;
  color: #fff7e8;
  background: #0e6375;
  font-size: 0.78rem;
  font-weight: 700;
}

.suggestion-detail {
  display: grid;
  gap: 6px;
}

.suggestion-detail span {
  color: #d9c7ff;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.price-strip {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 247, 232, 0.18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(7, 28, 37, 0.22);
  color: #fff7e8;
  font-size: 0.84rem;
  line-height: 1.35;
}

.price-strip span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.reason-list {
  display: grid;
  gap: 6px;
  padding-left: 18px;
  margin: 0;
  color: #e4f4f2;
  line-height: 1.35;
}

.warning {
  color: #d9c7ff;
  font-weight: 700;
}

.store-link-row {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.primary-button,
.ghost-button,
.pick-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border: 1px solid #b990ff;
  background: #b990ff;
  color: #160b2f;
}

.pick-button {
  border: 1px solid #b990ff;
  background: #b990ff;
  color: #160b2f;
  min-height: 56px;
  padding: 0 28px;
  font-size: 1.05rem;
  white-space: nowrap;
}

.pick-button.suggestion-main-button {
  width: 100%;
  max-width: 420px;
  min-height: 64px;
  padding: 0 18px;
  white-space: normal;
}

.ghost-button {
  border: 1px solid rgba(255, 247, 232, 0.62);
  background: transparent;
  color: inherit;
}

.source-link {
  align-self: center;
  color: #eadfff;
  font-size: 0.83rem;
  font-weight: 900;
}

.store-button {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid #b990ff;
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(185, 144, 255, 0.16);
  color: #eadfff;
  font-size: 1rem;
  text-align: center;
}

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

.saved-item,
.empty-state {
  border: 1px solid rgba(229, 246, 245, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: #0b4858;
  color: #fff7e8;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.small-button {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid rgba(255, 247, 232, 0.3);
  border-radius: 6px;
  background: #fff2d8;
  color: #082f3a;
  cursor: pointer;
  font-weight: 900;
}

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

  .control-grid,
  .import-grid,
  .market-grid,
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saved-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

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

  .section-heading,
  .market-heading,
  .picker-bar {
    align-items: start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-grid,
  .import-grid,
  .market-grid,
  .store-link-row,
  .store-offers,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .suggestion-actions-top {
    grid-template-columns: 1fr;
  }

  .inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .market-controls {
    width: 100%;
    grid-template-columns: 1fr;
  }
}
