:root {
  color-scheme: light;
  --accent: #7837e6;
  --accent-2: #dc62e9;
  --text: #17151c;
  --muted: #6d6b74;
  --line: #dedee6;
  --soft: #f4efff;
  --danger: #ff4d58;
  font-family: Inter, "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 95% 0, #f2edff 0, transparent 28rem), #fbfbfd; }
button, input, select { font: inherit; }
.page-shell { width: min(calc(100% - 48px), 1140px); margin: 0 auto; padding: 28px 0 48px; }
.back-to-hub { display: inline-flex; align-items: center; gap: 8px; margin: 0 10px 24px; color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
.back-to-hub:hover { color: var(--accent); }
.back-to-hub:focus-visible { outline: 3px solid rgba(120,55,230,.25); outline-offset: 5px; }
.hero { margin: 0 10px 34px; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: .76rem; font-weight: 900; letter-spacing: .12em; }
.hero-title-row { display: flex; align-items: center; gap: 22px; }
.hero-icon { flex: 0 0 78px; width: 78px; fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.1; letter-spacing: -.04em; }
.hero-title-row h1:only-child { margin-bottom: 0; }
.hero-title-row p { margin: 0; font-size: 1rem; }

.panel { margin-top: 22px; padding: 24px 28px 28px; border: 1px solid #e4e4e9; border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 4px 16px rgba(34, 31, 49, .08); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.section-title-row { display: flex; align-items: center; gap: 22px; }
.section-number { display: grid; place-items: center; flex: 0 0 50px; width: 50px; height: 50px; margin: 0; border-radius: 50%; color: var(--accent); background: linear-gradient(135deg, #eee6ff, #faf7ff); font-weight: 900; }
.section-heading h2 { margin: 0; font-size: 1.5rem; }
.section-heading h2 + p { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }

form { display: grid; grid-template-columns: 1.75fr 1fr 1fr; gap: 28px 30px; }
.field { position: relative; display: grid; align-content: start; gap: 10px; font-size: .88rem; font-weight: 700; }
.field b { color: #f33143; }
.field-wide { grid-column: auto; }
input, select { width: 100%; min-height: 56px; padding: 0 17px; border: 1px solid #d8d9e1; border-radius: 9px; color: var(--text); background: #fff; outline: none; }
input::placeholder { color: #797782; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(120,55,230,.12); }
.field-help { color: var(--muted); font-weight: 500; white-space: nowrap; }
.title-count { position: absolute; top: 48px; right: 15px; color: #4f4d55; font-weight: 500; }
input#game-title { padding-right: 70px; }
.field:has(.image-drop-zone) { grid-column: 1 / 2; }
.image-drop-zone { min-height: 172px; display: grid; place-content: center; gap: 6px; padding: 18px; border: 1.5px dashed #bca4ef; border-radius: 9px; background: #fff; text-align: center; cursor: pointer; }
.image-drop-zone:hover, .image-drop-zone.is-dragging { border-color: var(--accent); background: #fbf9ff; }
.image-drop-zone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.upload-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 2px; border-radius: 50%; color: var(--accent); background: var(--soft); font-size: 2.1rem; }
.image-drop-zone small { color: var(--muted); font-weight: 500; }
.image-selection { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.image-selection[hidden] { display: none; }
.image-selection button { border: 0; color: var(--danger); background: transparent; cursor: pointer; font-size: 1.4rem; }
.form-action { grid-column: 1 / -1; display: flex; align-items: center; gap: 28px; }
.primary-button, .delete-button { border-radius: 8px; cursor: pointer; font-weight: 800; }
.primary-button { min-height: 58px; padding: 0 32px; border: 0; color: white; background: linear-gradient(100deg, #6855f6, var(--accent-2)); box-shadow: 0 5px 12px rgba(120,55,230,.2); font-size: 1.08rem; }
.primary-button:disabled { cursor: not-allowed; filter: grayscale(.25); opacity: .58; }
.required-note { margin: 0; color: var(--muted); font-size: .85rem; }
.required-note span { margin-right: 8px; color: #a9a8af; font-size: .7rem; }
.error-message { min-height: 1.25rem; margin: 0; color: var(--danger); font-weight: 700; white-space: pre-line; }

.count-badge { padding: 10px 18px; border-radius: 999px; background: #f6f6f8; font-weight: 800; }
.game-filters { display: flex; gap: 12px; margin: 0 0 22px; overflow-x: auto; padding: 2px; }
.game-list-tools { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px); gap: 16px; margin: 0 0 22px; }
.game-list-tool { display: grid; gap: 7px; color: #55525d; font-size: .82rem; font-weight: 800; }
.game-list-tool input, .game-list-tool select { min-height: 46px; }
.filter-tab { flex: 0 0 auto; min-height: 44px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px; color: #55525d; background: #fff; cursor: pointer; font-weight: 700; }
.filter-tab span { margin-right: 7px; }
.filter-tab:hover { border-color: #b7a4df; }
.filter-tab[aria-selected="true"] { color: var(--accent); border-color: transparent; background: linear-gradient(110deg, #e8e0ff, #f7e8ff); }
.filter-tab:focus-visible { outline: 3px solid rgba(120,55,230,.25); outline-offset: 2px; }
.list-head { display: grid; grid-template-columns: 136px minmax(156px, 1fr) 102px 152px 92px; gap: 18px; padding: 0 12px 10px; font-size: .82rem; font-weight: 700; }
.list-head > span:first-child { grid-column: 1 / 3; }
.empty-message { padding: 42px 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.game-list { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; list-style: none; }
.game-list:empty { display: none; }
.game-card { display: grid; grid-template-columns: 136px minmax(156px, 1fr) 102px 152px 92px; grid-template-areas: "image details platform status delete"; align-items: center; gap: 18px; min-height: 90px; padding: 12px; background: #fff; }
.game-card + .game-card { border-top: 1px solid var(--line); }
.game-image { grid-area: image; width: 136px; aspect-ratio: 2 / 1; display: grid; place-items: center; overflow: hidden; border-radius: 6px; color: #fff; background: #999; font-weight: 800; text-align: center; }
.game-image img { width: 100%; height: 100%; object-fit: cover; background: #999; }
.game-details { grid-area: details; }
.game-card h3 { margin: 0; font-size: .94rem; }
.tag { justify-self: start; padding: 5px 9px; border: 1px solid currentColor; border-radius: 5px; font-size: .8rem; }
.platform-tag { grid-area: platform; color: #8e48e8; }
.status-tag { color: #2a91e9; }
.status-select { grid-area: status; min-height: 42px; padding: 0 32px 0 11px; border-color: currentColor; color: #2a91e9; font-size: .8rem; font-weight: 700; }
.status-クリア { color: #36aa61; }
.status-積みゲー { color: #e99c12; }
.status-断念 { color: #7b7b83; }
.delete-button { grid-area: delete; display: grid; place-items: center; justify-self: end; width: 34px; height: 34px; min-height: 34px; padding: 0; color: var(--danger); background: #fff; border: 1px solid #ff9097; border-radius: 50%; }
.delete-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.delete-button:hover { background: #fff5f5; }

@media (max-width: 850px) {
  form { grid-template-columns: 1fr 1fr; }
  .field-wide, .field:has(.image-drop-zone) { grid-column: 1 / -1; }
  .list-head { display: none; }
  .game-card { grid-template-columns: 120px minmax(140px, 1fr) 130px 84px; grid-template-areas: "image details platform delete" "image details status delete"; gap: 12px; }
  .game-image { width: 120px; }
}

@media (max-width: 620px) {
  .page-shell { width: min(calc(100% - 24px), 1140px); padding-top: 20px; }
  .hero { margin-inline: 4px; }
  .hero-icon { flex-basis: 58px; width: 58px; }
  .panel { padding: 20px 16px; }
  form { grid-template-columns: 1fr; gap: 20px; }
  .field-wide, .field:has(.image-drop-zone) { grid-column: auto; }
  .form-action { flex-direction: column; align-items: stretch; gap: 12px; }
  .game-list-tools { grid-template-columns: 1fr; gap: 12px; }
  .game-card { grid-template-columns: 82px auto minmax(74px, 1fr) auto; grid-template-areas: "image details details details" "image platform status delete"; column-gap: 8px; row-gap: 10px; }
  .game-image { width: 82px; }
  .tag { font-size: .72rem; }
  .status-select { min-height: 36px; padding-inline: 8px 24px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
}

@media (max-width: 360px) {
  .game-card { grid-template-columns: 72px auto minmax(0, 1fr); grid-template-areas: "image details details" "image platform status" "image . delete"; }
  .game-image { width: 72px; }
  .delete-button { justify-self: end; }
}
