:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --paper: #fffdf8;
  --ink: #20231f;
  --muted: #687066;
  --line: #d8d2c5;
  --accent: #23614d;
  --accent-strong: #174736;
  --red: #c91f37;
  --blue: #174ea6;
  --gold: #c99120;
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Apple SD Gothic Neo",
    "Malgun Gothic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(32, 35, 31, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(32, 35, 31, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  padding: 12px clamp(16px, 4vw, 36px);
}

.site-name {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 16px 40px rgba(32, 35, 31, 0.08);
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
}

.stack {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(35, 97, 77, 0.22);
  border-color: var(--accent);
}

.button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

.button.primary {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.button.ghost {
  background: transparent;
  color: var(--accent-strong);
}

.profile-header {
  display: block;
}

.profile-title {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #161817;
  color: #fff;
  padding: 10px 14px;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.preview {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161817;
  color: #fff;
  padding: 16px;
  text-align: center;
  font-size: 24px;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-top: 22px;
}

.tab-button {
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 10px 14px;
}

.tab-button[aria-selected="true"] {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  transform: translateY(1px);
}

.tab-panel {
  padding-top: 18px;
}

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

.banner-button,
.banner-card {
  display: grid;
  gap: 8px;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.banner-card {
  cursor: default;
}

.banner-button[data-active="true"],
.banner-card[data-active="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(35, 97, 77, 0.18);
}

.banner-button:focus-visible {
  outline: 2px solid rgba(35, 97, 77, 0.32);
  outline-offset: 2px;
}

.banner-title-row {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.banner-title {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  min-width: 0;
  white-space: pre-line;
}

.banner-title[href]:hover {
  text-decoration: underline;
}

.banner-detail {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.banner-preview {
  align-self: end;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #161817;
  color: #fff;
  font-size: 18px;
  min-height: 40px;
  padding: 8px 10px;
  text-align: center;
}

.entity-toolbar {
  margin-bottom: 12px;
  max-width: 420px;
}

.wtrec-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 8px;
  max-width: 560px;
}

.entity-grid {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.game-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: none;
}

.item-grid {
  gap: 7px;
  max-width: none;
  width: 100%;
}

.game-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(32, 35, 31, 0.06);
}

.game-card .entity-media img {
  aspect-ratio: 4 / 3;
}

.game-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px 12px;
}

.game-card-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.game-download-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 8px;
}

.game-download-button:hover {
  border-color: var(--accent);
  background: #eef5f1;
}

.entity-media {
  display: block;
  background: #161817;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  border-radius: 5px;
}

.entity-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #161817;
}

.entity-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.entity-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.entity-meta[href]:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.item-chat-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #161817;
  color: #f0eee8;
  padding: 3px 6px;
}

.item-chat-row:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: #1d201f;
}

.item-chat-time {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 170px;
  min-height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: #252a29;
  color: #c3cbc3;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.item-chat-separator {
  color: #8f978f;
  font-weight: 900;
  margin: 0 6px;
}

.chat-message {
  flex: 1 1 260px;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.item-chat-media {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  color: inherit;
  text-decoration: none;
}

.item-chat-media img {
  display: block;
  max-width: 32px;
  max-height: 32px;
  cursor: pointer;
}

.item-chat-name {
  margin-left: 0.5em;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.pager-status {
  color: var(--muted);
  min-width: 120px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.entity-sentinel {
  height: 1px;
}

.entity-spacer {
  grid-column: 1 / -1;
  min-height: 0;
  pointer-events: none;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  padding: 18px;
  text-align: center;
}

.wtrec-list {
  display: grid;
  gap: 8px;
}

.wtrec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  text-decoration: none;
}

.wtrec-row:hover {
  border-color: var(--accent);
  background: #f7fbf8;
}

.wtrec-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.wtrec-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wtrec-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wtrec-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  padding: 5px 10px;
  white-space: nowrap;
}

.wtrec-limit-notice {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  padding: 8px 2px;
  text-align: center;
}

.wtrec-sentinel {
  height: 1px;
}

.status {
  min-height: 24px;
  color: var(--red);
}

@media (max-width: 680px) {
  .game-grid {
    grid-template-columns: 1fr;
  }

  .wtrec-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .wtrec-action {
    justify-self: start;
  }

  .wtrec-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 681px) and (max-width: 980px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
