:root {
  --bg: #111419;
  --surface: #1a2028;
  --surface-soft: #242c36;
  --line: #343f4d;
  --text: #ece6d9;
  --muted: #a4afbd;
  --blue: #6ea8ff;
  --blue-soft: #172943;
  --red: #ff6b82;
  --red-soft: #3b202a;
  --green: #2aae83;
  --gold: #caa664;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

button {
  font: inherit;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.title-group {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.title-subtitle {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.translation-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.translation-note:empty {
  display: none;
}

.creator-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.language-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.language-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.language-button:hover {
  border-color: #5b6878;
  background: var(--surface-soft);
}

.language-button.is-active {
  border-color: var(--blue);
  color: #d7e7ff;
  background: var(--blue-soft);
}

.controls {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.control-row,
.custom-controls,
.offmeta-controls {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.custom-controls,
.offmeta-controls {
  align-items: start;
}

.control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 34px;
}

.segmented,
.mode-list,
.lane-edit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.choice-button,
.lane-edit-button,
.secondary-button,
.primary-button,
.copy-button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.choice-button,
.lane-edit-button {
  height: 34px;
  min-width: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.mode-list .choice-button {
  position: relative;
}

.mode-list .choice-button::after {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 12;
  visibility: hidden;
  opacity: 0;
  width: max-content;
  max-width: min(260px, calc(100vw - 32px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  content: attr(data-help);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  pointer-events: none;
  white-space: normal;
  transform: translateX(-50%);
  transition: opacity 120ms ease, visibility 0ms linear 120ms;
}

.mode-list .choice-button:hover::after,
.mode-list .choice-button:focus-visible::after {
  visibility: visible;
  opacity: 1;
  transition-delay: 1s, 1s;
}

.choice-button:hover,
.lane-edit-button:hover,
.secondary-button:hover,
.copy-button:hover:not(:disabled) {
  border-color: #5b6878;
  background: var(--surface-soft);
}

.choice-button.is-active {
  border-color: var(--blue);
  color: #d7e7ff;
  background: var(--blue-soft);
}

.custom-controls,
.offmeta-controls {
  padding-top: 4px;
}

.custom-controls.is-hidden,
.offmeta-controls.is-hidden,
.modal.is-hidden {
  display: none;
}

.offmeta-option-list {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.checkbox-label > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ja-option-break {
  display: none;
}

html[lang="ja"] .ja-option-break {
  display: block;
  height: 0;
}

.tooltip-term {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-bottom: 1px dotted var(--muted);
  color: var(--blue);
  cursor: help;
  outline: none;
}

.tooltip-panel {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 30;
  visibility: hidden;
  opacity: 0;
  width: max-content;
  min-width: 180px;
  max-width: min(240px, calc(100vw - 32px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.65;
  overflow-wrap: normal;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 120ms ease 500ms, visibility 0ms linear 500ms;
}

.tooltip-term:hover .tooltip-panel,
.tooltip-term:focus .tooltip-panel,
.tooltip-term:focus-within .tooltip-panel {
  visibility: visible;
  opacity: 1;
  transition-delay: 500ms;
}

.pick-button {
  min-height: 42px;
  margin-top: 6px;
  border: 1px solid #347ad8;
  border-radius: 8px;
  color: #ffffff;
  background: #245fae;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(19, 75, 145, 0.24);
  transition: transform 150ms ease, filter 150ms ease;
}

.pick-button:hover {
  filter: brightness(1.04);
}

.pick-button:active,
.choice-button:active,
.lane-edit-button:active,
.secondary-button:active,
.primary-button:active,
.copy-button:active:not(:disabled) {
  transform: translateY(1px);
}

.status-message {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status-message:empty {
  display: none;
}

.status-message.is-error {
  color: var(--red);
}

.results {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin-top: 20px;
}

.result-grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.result-grid.result-grid--ten {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-grid.result-grid--five {
  grid-template-columns: minmax(0, 620px);
}

.team-column {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.team-column--blue {
  border-top: 4px solid var(--blue);
}

.team-column--red {
  border-top: 4px solid var(--red);
}

.team-column--solo {
  border-top: 4px solid var(--blue);
}

.team-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 900;
}

.team-column--blue .team-heading {
  color: var(--blue);
  background: var(--blue-soft);
}

.team-column--red .team-heading {
  color: var(--red);
  background: var(--red-soft);
}

.team-column--solo .team-heading {
  color: var(--blue);
  background: var(--blue-soft);
}

.result-rows {
  display: grid;
}

.result-row {
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 76px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  background-position: center 28%;
  background-size: cover;
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row--picked {
  border-bottom-color: rgba(255, 255, 255, 0.18);
}

.result-row--picked .lane-mark,
.result-row--picked .champion-name {
  color: #f1eee6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.result-row--picked .lane-mark img {
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
}

.result-row--picked .champion-slot img {
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.35);
}

.lane-mark {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.lane-mark img {
  width: 21px;
  height: 21px;
  object-fit: contain;
}

.champion-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.champion-slot img,
.empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.champion-slot img {
  object-fit: cover;
  background: var(--surface-soft);
}

.empty-icon {
  border: 1px dashed #4a5666;
  background: #151a21;
}

.champion-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
}

.copy-button {
  justify-self: center;
  width: 266px;
  padding: 0 18px;
  font-weight: 800;
}

.copy-button:disabled {
  color: #697482;
  cursor: not-allowed;
  background: #202733;
}

.legal-footer {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}

.legal-footer p {
  margin: 0;
}

.legal-footer p + p {
  margin-top: 5px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.footer-link {
  color: var(--blue);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: #9fc4ff;
}

.policy-modal-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(640px, 100%);
}

.policy-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 20px;
  color: var(--text);
  background: #171d25;
}

.policy-section + .policy-section {
  margin-top: 18px;
}

.policy-section h3 {
  margin: 0 0 6px;
  color: #d7dee9;
  font-size: 15px;
  line-height: 1.35;
}

.policy-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.policy-section p + p {
  margin-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 12, 0.74);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-toolbar,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}

.modal-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.modal-toolbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.secondary-button,
.primary-button {
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

.primary-button:hover {
  filter: brightness(1.04);
}

.modal-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.editor-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 0;
}

.editor-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #171d25;
}

.editor-column:last-child {
  border-right: 0;
}

.editor-column.is-drop-target {
  background: #193328;
}

.editor-column h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}

.champ-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow: auto;
}

.champ-token {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.champ-token:hover {
  border-color: #5b6878;
  background: var(--surface-soft);
}

.champ-token img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
}

.champ-token span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.18;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding-top: 18px;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .language-switch {
    justify-content: flex-start;
  }

  .control-row,
  .custom-controls,
  .offmeta-controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .choice-button,
  .lane-edit-button {
    flex: 1 1 calc(50% - 8px);
  }

  .segmented .choice-button {
    flex-basis: calc(50% - 4px);
  }

  .pick-button {
    min-height: 42px;
    font-size: 16px;
  }

  .result-grid.result-grid--ten {
    gap: 8px;
  }

  .team-heading {
    min-height: 34px;
    padding: 0 10px;
    font-size: 15px;
  }

  .result-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 7px;
    min-height: 68px;
    padding: 8px;
  }

  .lane-mark {
    display: grid;
    justify-items: center;
    gap: 3px;
    font-size: 11px;
  }

  .lane-mark img {
    width: 20px;
    height: 20px;
  }

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

  .champion-slot img,
  .empty-icon {
    width: 38px;
    height: 38px;
  }

  .champion-name {
    font-size: 14px;
  }

  .editor-columns {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .editor-column {
    min-height: 330px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-column:last-child {
    border-bottom: 0;
  }

  .modal-panel {
    max-height: calc(100vh - 22px);
  }

  .modal-header,
  .modal-toolbar,
  .modal-actions {
    padding: 12px;
  }
}

@media (max-width: 420px) {
  .app-shell {
    width: min(100% - 14px, 1080px);
  }

  .controls {
    padding: 14px;
  }

  .mode-list .choice-button {
    flex-basis: calc(50% - 4px);
  }

  .result-row {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 7px 5px;
  }

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

  .champion-slot img,
  .empty-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }

  .champion-name {
    font-size: 12px;
  }

  .copy-button {
    justify-self: stretch;
  }
}
