:root {
  --bg: #0b1110;
  --surface: rgba(20, 28, 26, 0.9);
  --surface-strong: rgba(30, 39, 36, 0.94);
  --surface-soft: rgba(244, 219, 150, 0.08);
  --text: #fff7e7;
  --muted: #bcb099;
  --line: rgba(244, 219, 150, 0.16);
  --line-strong: rgba(244, 219, 150, 0.3);
  --accent: #d9a230;
  --accent-strong: #f2c257;
  --accent-soft: rgba(217, 162, 48, 0.15);
  --gold: #f0c75b;
  --gold-soft: rgba(240, 199, 91, 0.16);
  --red: #e76548;
  --red-soft: rgba(231, 101, 72, 0.14);
  --green: #69c17f;
  --green-soft: rgba(105, 193, 127, 0.15);
  --blue: #66b5d8;
  --blue-soft: rgba(102, 181, 216, 0.14);
  --ink: #0b100f;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(130deg, rgba(28, 73, 62, 0.2), transparent 38%),
    linear-gradient(180deg, #0b1110 0%, #101715 48%, #130f0b 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(244, 219, 150, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 219, 150, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), transparent 76%);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(240, 199, 91, 0.7);
  outline-offset: 2px;
}

button {
  cursor: pointer;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 199, 91, 0.42) rgba(9, 14, 13, 0.55);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(9, 14, 13, 0.55);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(9, 14, 13, 0.55);
  border-radius: 999px;
  background: rgba(240, 199, 91, 0.42);
}

.app-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  min-height: 300px;
  padding: 34px clamp(18px, 4vw, 48px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(6, 12, 11, 0.92) 0%, rgba(6, 12, 11, 0.62) 38%, rgba(6, 12, 11, 0.04) 70%, rgba(6, 12, 11, 0.5) 100%),
    linear-gradient(180deg, rgba(6, 12, 11, 0.04) 0%, transparent 54%, rgba(11, 17, 16, 0.98) 100%),
    url("assets/five-elements-hero.jpg") center 42% / cover no-repeat;
  border-bottom: 1px solid rgba(240, 199, 91, 0.2);
}

.app-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 96px;
  background: linear-gradient(180deg, transparent, rgba(11, 17, 16, 0.98));
  pointer-events: none;
}

.brand-block,
.header-actions {
  position: relative;
  z-index: 1;
}

.brand-block {
  min-width: 0;
  max-width: 600px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  border: 1px solid rgba(240, 199, 91, 0.28);
  border-radius: 999px;
  background: rgba(11, 17, 16, 0.5);
  color: var(--gold);
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}

h1,
h2,
h3,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin-bottom: 14px;
  color: #fff8e8;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: 0;
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.68);
}

h2 {
  margin-bottom: 14px;
  color: #fff5df;
  font-size: 22px;
}

h3 {
  margin-bottom: 10px;
  color: #fff5df;
  font-size: 17px;
}

.element-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.element-ribbon span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.28);
}

.element-metal {
  background: linear-gradient(145deg, #fff1a8, #8b6926);
}

.element-wood {
  background: linear-gradient(145deg, #74d889, #1e6c45);
}

.element-water {
  background: linear-gradient(145deg, #70c7ef, #1a597a);
}

.element-fire {
  background: linear-gradient(145deg, #ff8062, #9e2218);
}

.element-earth {
  background: linear-gradient(145deg, #d4a15b, #704722);
}

.header-actions,
.section-actions,
.inline-actions,
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-actions {
  justify-content: flex-end;
  max-width: 520px;
  padding: 14px;
  border: 1px solid rgba(240, 199, 91, 0.2);
  border-radius: 8px;
  background: rgba(8, 13, 12, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.week-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f0dfb6;
  font-size: 14px;
  font-weight: 700;
}

.auth-box {
  display: grid;
  gap: 6px;
  min-width: min(260px, 100%);
}

.auth-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.auth-status strong {
  color: #fff6e4;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(9, 14, 13, 0.82);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(240, 199, 91, 0.16);
}

select[disabled],
input[disabled],
textarea[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

.button {
  min-height: 38px;
  border: 1px solid rgba(240, 199, 91, 0.75);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd873, #b77d22);
  color: #1d1407;
  padding: 8px 13px;
  font-weight: 900;
  text-shadow: 0 1px rgba(255, 255, 255, 0.22);
  box-shadow: 0 11px 24px rgba(0, 0, 0, 0.24);
  transition: transform 0.12s ease, filter 0.12s ease, border 0.12s ease, box-shadow 0.12s ease;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover {
  border-color: #fff0b8;
  filter: brightness(1.08);
  box-shadow: 0 13px 28px rgba(0, 0, 0, 0.3);
}

.button:active {
  transform: translateY(1px);
}

.button-secondary {
  border-color: rgba(240, 199, 91, 0.36);
  background: rgba(14, 22, 20, 0.84);
  color: #ffe8a2;
  text-shadow: none;
}

.button-secondary:hover {
  background: rgba(48, 42, 25, 0.92);
}

.button-danger {
  border-color: rgba(231, 101, 72, 0.72);
  background: rgba(50, 20, 17, 0.9);
  color: #ffc5ba;
  text-shadow: none;
}

.button-danger:hover {
  background: rgba(92, 31, 24, 0.94);
  border-color: #ff9b86;
}

.button[disabled],
.segmented button[disabled] {
  cursor: not-allowed;
  opacity: 0.48;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 11px clamp(18px, 4vw, 48px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(240, 199, 91, 0.18);
  background: linear-gradient(180deg, rgba(14, 20, 18, 0.94), rgba(8, 13, 12, 0.9));
  backdrop-filter: blur(18px);
}

.tab-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 82px;
  min-height: 42px;
  border: 1px solid rgba(244, 219, 150, 0.1);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.02);
  color: #d7c6a0;
  padding: 9px 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease, border 0.14s ease;
}

.tab-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0.88;
}

.tab-label {
  line-height: 1;
}

.tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 199, 91, 0.34);
  background: rgba(240, 199, 91, 0.07);
  color: #ffe8a2;
}

.tab-button.is-active {
  border-color: rgba(240, 199, 91, 0.72);
  background: linear-gradient(180deg, rgba(240, 199, 91, 0.2), rgba(240, 199, 91, 0.08));
  color: #fff1bc;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.tab-button.is-active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 5px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 14px rgba(242, 194, 87, 0.55);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 48px) 48px;
}

.site-footer {
  display: flex;
  justify-content: center;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px) 28px;
  text-align: center;
}

.site-footer a {
  color: rgba(255, 247, 231, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff1bc;
  text-decoration: underline;
}

.readonly-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border: 1px solid rgba(102, 181, 216, 0.26);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(102, 181, 216, 0.13), rgba(102, 181, 216, 0.06));
  color: #c4edff;
  padding: 10px 12px;
}

.readonly-banner strong {
  color: #e8f7ff;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

.panel,
.metric,
.team-card,
.match-card,
.rule-card {
  min-width: 0;
  border: 1px solid rgba(244, 219, 150, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 225, 0.06), rgba(255, 248, 225, 0.018) 72%),
    var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 0;
}

.panel-body {
  padding: 18px;
}

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

.mini {
  font-size: 12px;
}

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

.metric {
  position: relative;
  min-height: 102px;
  padding: 15px 15px 14px;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #f0c75b, #69c17f, #66b5d8, #e76548);
  opacity: 0.78;
}

.metric-label {
  margin: 0 0 8px;
  color: #d7c7a3;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.metric-value {
  margin: 0;
  color: #fff6e4;
  font-size: 26px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.metric .muted {
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.mini-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(244, 219, 150, 0.12);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.055);
  padding: 10px;
}

.mini-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-metric strong {
  color: #fff5df;
  font-size: 18px;
}

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

.honor-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(244, 219, 150, 0.12);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.055);
  padding: 10px;
}

.honor-item strong {
  display: block;
  margin: 2px 0;
  color: #fff5df;
  font-size: 16px;
}

.honor-item p,
.honor-item small {
  margin: 0;
}

.honor-item p {
  color: var(--gold);
  font-weight: 900;
}

.honor-item small {
  color: var(--muted);
}

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

.relationship-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(102, 181, 216, 0.16);
  border-radius: 8px;
  background: rgba(102, 181, 216, 0.055);
  padding: 10px;
}

.relationship-item-column {
  display: block;
}

.relationship-avatars {
  display: flex;
  align-items: center;
}

.relationship-avatars .player-avatar {
  width: 42px;
  border-color: rgba(102, 181, 216, 0.34);
  font-size: 17px;
}

.relationship-avatars .player-avatar + .player-avatar {
  margin-left: -10px;
}

.relationship-item strong {
  display: block;
  min-width: 0;
  margin: 2px 0;
  color: #fff5df;
  font-size: 16px;
}

.relationship-item p,
.relationship-item small {
  margin: 0;
}

.relationship-item p {
  color: #c4edff;
  font-weight: 900;
}

.relationship-item small {
  color: var(--muted);
}

.relationship-tags,
.title-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.relationship-tags {
  margin: 8px 0 6px;
}

.relationship-tag,
.title-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  border: 1px solid rgba(244, 219, 150, 0.14);
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.07);
  color: #ead9b4;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.relationship-tag strong {
  display: inline;
  margin: 0;
  font-size: 12px;
}

.relationship-tag small {
  color: var(--muted);
}

.relationship-tag-empty {
  color: var(--muted);
}

.storyline-list,
.highlight-record-list {
  display: grid;
  gap: 10px;
}

.storyline-item,
.highlight-record {
  min-width: 0;
  border: 1px solid rgba(105, 193, 127, 0.16);
  border-radius: 8px;
  background: rgba(105, 193, 127, 0.055);
  padding: 12px;
}

.storyline-item span {
  display: inline-flex;
  min-height: 24px;
  border: 1px solid rgba(105, 193, 127, 0.28);
  border-radius: 999px;
  color: #c7f7cf;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
}

.storyline-item strong,
.highlight-record strong {
  display: block;
  margin: 8px 0 4px;
  color: #fff5df;
  font-size: 17px;
}

.storyline-item p,
.highlight-record p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.highlight-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.player-detail-header {
  padding-bottom: 0;
}

.player-detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
}

.player-detail-title {
  min-width: 0;
}

.detail-back {
  width: fit-content;
  min-height: 34px;
  margin-bottom: 12px;
}

.player-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.player-avatar {
  display: grid;
  place-items: center;
  width: 86px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 199, 91, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(240, 199, 91, 0.16), rgba(102, 181, 216, 0.1)),
    rgba(9, 14, 13, 0.86);
  color: #fff1bc;
  overflow: hidden;
  font-size: 34px;
  font-weight: 900;
}

.player-avatar-large {
  width: min(180px, 32vw);
}

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

.avatar-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.avatar-upload-button {
  position: relative;
  overflow: hidden;
}

.avatar-upload-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.avatar-lock-hint {
  margin: 12px 0 0;
}

.player-link {
  color: #fff3c6;
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 199, 91, 0.45);
}

.player-link:hover {
  color: #ffe28a;
  border-bottom-color: #ffe28a;
}

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

.team-poster {
  min-width: 0;
  border: 1px solid rgba(240, 199, 91, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(240, 199, 91, 0.12), rgba(102, 181, 216, 0.06)),
    rgba(9, 14, 13, 0.7);
  padding: 13px;
}

.team-poster.is-ranked {
  border-color: rgba(240, 199, 91, 0.58);
}

.team-poster-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.team-poster-head strong {
  display: block;
  color: #fff5df;
  font-size: 22px;
}

.team-poster-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.poster-member-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.poster-member {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid rgba(244, 219, 150, 0.1);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.045);
  padding: 8px 6px;
  text-align: center;
}

.poster-member .player-avatar {
  width: 48px;
  font-size: 18px;
}

.poster-member strong {
  max-width: 100%;
  overflow: hidden;
  color: #fff5df;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-member span {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.poster-member i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  border: 1px solid rgba(244, 219, 150, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.record-card {
  border: 1px solid rgba(240, 199, 91, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(240, 199, 91, 0.16), rgba(105, 193, 127, 0.08), rgba(102, 181, 216, 0.1)),
    rgba(9, 14, 13, 0.72);
  padding: 16px;
}

.record-card-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.record-card-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.record-card h3 {
  margin-bottom: 6px;
  font-size: 30px;
}

.record-title {
  display: inline-flex;
  margin-top: 8px;
  border: 1px solid rgba(240, 199, 91, 0.42);
  border-radius: 999px;
  color: #ffe8a2;
  padding: 5px 10px;
}

.title-badge-row {
  margin-top: 9px;
}

.title-badge {
  border-color: rgba(105, 193, 127, 0.22);
  background: rgba(105, 193, 127, 0.1);
  color: #c7f7cf;
}

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

.info-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-list div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-bottom: 1px solid rgba(244, 219, 150, 0.1);
  padding-bottom: 9px;
}

.info-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.info-list dd {
  min-width: 0;
  margin: 0;
  color: #fff5df;
  overflow-wrap: anywhere;
}

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

.team-card {
  min-width: 0;
}

.team-card.is-ranked {
  border-color: rgba(240, 199, 91, 0.66);
}

.team-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(240, 199, 91, 0.11), transparent);
}

.team-title strong {
  min-width: 0;
  overflow: hidden;
  color: #fff5df;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  list-style: none;
}

.member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  border: 1px solid rgba(244, 219, 150, 0.1);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 6px 8px;
}

.member > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-meta {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(244, 219, 150, 0.16);
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.08);
  color: #d8c8a5;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-green {
  border-color: rgba(105, 193, 127, 0.34);
  background: var(--green-soft);
  color: #b9f4c6;
}

.badge-gold {
  border-color: rgba(240, 199, 91, 0.42);
  background: var(--gold-soft);
  color: #ffeaa0;
}

.badge-red {
  border-color: rgba(231, 101, 72, 0.34);
  background: var(--red-soft);
  color: #ffc2b6;
}

.role-fire {
  border-color: rgba(231, 101, 72, 0.4);
  background: rgba(231, 101, 72, 0.16);
  color: #ffc2b6;
}

.role-wood {
  border-color: rgba(105, 193, 127, 0.4);
  background: rgba(105, 193, 127, 0.16);
  color: #c7f7cf;
}

.role-water {
  border-color: rgba(102, 181, 216, 0.42);
  background: rgba(102, 181, 216, 0.16);
  color: #c4edff;
}

.role-metal {
  border-color: rgba(240, 199, 91, 0.42);
  background: rgba(240, 199, 91, 0.16);
  color: #ffeaa0;
}

.role-earth {
  border-color: rgba(212, 161, 91, 0.42);
  background: rgba(212, 161, 91, 0.17);
  color: #ffd7a0;
}

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

.week-summary-list {
  display: grid;
  gap: 16px;
}

.week-summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 18, 17, 0.58);
}

.week-summary-head,
.week-summary-grid {
  display: grid;
  gap: 12px;
}

.week-summary-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-bottom: 12px;
}

.week-summary-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.week-summary-block h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.archive-list {
  display: grid;
  gap: 12px;
}

.archive-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 18, 17, 0.58);
  overflow: hidden;
}

.archive-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.archive-summary::-webkit-details-marker {
  display: none;
}

.archive-summary:hover {
  background: rgba(240, 199, 91, 0.06);
}

.archive-summary-main,
.archive-summary-meta {
  min-width: 0;
}

.archive-summary-main {
  display: grid;
  gap: 4px;
}

.archive-summary-main strong {
  color: #fff5df;
}

.archive-summary-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-open-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(240, 199, 91, 0.48);
  border-radius: 999px;
  color: #ffe8a2;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
}

.archive-open-label::after {
  content: "↓";
  margin-left: 6px;
}

.archive-item[open] .archive-open-label::after {
  content: "↑";
}

.archive-detail {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.archive-section {
  min-width: 0;
}

.archive-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.archive-section-head h3,
.archive-section-head p {
  margin-bottom: 0;
}

.match-card {
  padding: 15px;
}

.match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  margin-bottom: 10px;
}

.versus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.versus strong {
  overflow: hidden;
  color: #fff3d6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.versus span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.game-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: rgba(9, 14, 13, 0.72);
  color: #d7c6a0;
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-active {
  background: linear-gradient(180deg, #f0c75b, #9a6820);
  color: #1d1407;
}

.match-highlight-control {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid rgba(244, 219, 150, 0.12);
  padding-top: 12px;
}

.highlight-choice-grid,
.match-highlight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.highlight-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: 100%;
  border: 1px solid rgba(244, 219, 150, 0.16);
  border-radius: 999px;
  background: rgba(255, 248, 225, 0.06);
  color: #ead9b4;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.highlight-choice input {
  width: 14px;
  height: 14px;
  min-height: 0;
  accent-color: #f0c75b;
}

.highlight-choice.is-active,
.match-highlight-tag {
  border-color: rgba(240, 199, 91, 0.38);
  background: rgba(240, 199, 91, 0.13);
  color: #ffe8a2;
}

.match-highlight-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(240, 199, 91, 0.38);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(244, 219, 150, 0.14);
  border-radius: 8px;
  background: rgba(9, 14, 13, 0.54);
}

.table-wrap-compact table {
  min-width: 560px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: transparent;
}

th,
td {
  border-bottom: 1px solid rgba(244, 219, 150, 0.12);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: rgba(255, 248, 225, 0.035);
  color: #decda6;
  font-size: 12px;
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(240, 199, 91, 0.055);
}

.rank-cell {
  width: 48px;
  color: var(--gold);
  font-weight: 900;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label,
.check-field {
  color: #ddcda7;
  font-size: 13px;
  font-weight: 800;
}

.field-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-hint.is-warning {
  color: #ffc2b6;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

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

.rule-card {
  padding: 16px;
}

.rule-card ul {
  margin: 0;
  padding-left: 20px;
}

.rule-card li {
  margin: 7px 0;
}

.empty-state {
  border: 1px dashed rgba(244, 219, 150, 0.28);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.05);
  padding: 22px;
  text-align: center;
}

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

.log-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 225, 0.055);
  padding: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(240, 199, 91, 0.38);
  border-radius: 8px;
  background: rgba(15, 21, 20, 0.96);
  color: #fff6e4;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .app-header {
    min-height: 284px;
    align-items: flex-end;
  }

  .page-grid,
  .team-grid,
  .week-summary-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 360px;
    padding: 24px 14px 20px;
    background-position: 58% top;
  }

  h1 {
    font-size: 42px;
  }

  h2 {
    font-size: 20px;
  }

  .element-ribbon span {
    width: 32px;
    height: 32px;
  }

  .header-actions {
    align-items: stretch;
    max-width: none;
    width: 100%;
    padding: 12px;
  }

  .week-picker,
  .auth-box,
  .header-actions .button {
    width: 100%;
  }

  .auth-login {
    grid-template-columns: 1fr;
  }

  select,
  input,
  textarea,
  .button {
    min-height: 44px;
  }

  .button {
    width: 100%;
    padding: 10px 12px;
  }

  .tabbar {
    gap: 7px;
    padding: 10px 14px;
  }

  .tab-button {
    min-width: 76px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .tab-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  .app-shell {
    padding: 18px 14px 42px;
  }

  .app-shell,
  .stack,
  .page-grid,
  .panel,
  .panel-header,
  .panel-body,
  .metric-grid,
  .team-grid,
  .match-grid,
  .form-grid,
  .rule-grid {
    min-width: 0;
    max-width: 100%;
  }

  .panel {
    width: 100%;
  }

  .readonly-banner {
    align-items: flex-start;
  }

  .week-picker select {
    width: 100%;
    min-width: 0;
  }

  .week-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .page-grid,
  .team-grid,
  .team-poster-grid,
  .match-grid,
  .week-summary-grid,
  .form-grid,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mini-metric-grid {
    grid-template-columns: 1fr;
  }

  .poster-member-grid,
  .record-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .info-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .metric {
    min-height: 92px;
    padding: 13px 12px 12px;
  }

  .metric-value {
    font-size: 24px;
  }

  .panel-header {
    flex-direction: column;
    padding: 16px 14px 0;
  }

  .panel-header .muted,
  .panel-body .muted {
    line-height: 1.62;
    word-break: break-all;
  }

  .panel-body {
    padding: 14px;
  }

  .inline-actions,
  .section-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .archive-summary,
  .archive-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .archive-summary-meta {
    justify-content: flex-start;
    width: 100%;
  }

  .player-detail-hero {
    flex-direction: column;
  }

  .highlight-record {
    grid-template-columns: 1fr;
  }

  .record-card-hero {
    grid-template-columns: 1fr;
  }

  .player-avatar-large {
    width: min(220px, 100%);
  }

  .avatar-upload {
    align-items: stretch;
    flex-direction: column;
  }

  .versus {
    grid-template-columns: 1fr;
  }

  .versus span {
    display: none;
  }

  .game-row {
    grid-template-columns: 1fr;
  }

  .segmented button {
    min-height: 44px;
    overflow: hidden;
    padding: 8px 5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .team-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .team-title strong,
  .member > span {
    white-space: normal;
  }

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

  .member-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid rgba(244, 219, 150, 0.14);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(255, 248, 225, 0.055), rgba(255, 248, 225, 0.018) 72%),
      rgba(20, 28, 26, 0.9);
    box-shadow: var(--shadow-soft);
  }

  .table-wrap tr:last-child {
    margin-bottom: 0;
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(82px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 46px;
    border-bottom: 1px solid rgba(244, 219, 150, 0.1);
    padding: 10px 12px;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: #d7c7a3;
    font-size: 12px;
    font-weight: 900;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td > input,
  .table-wrap td > select {
    min-width: 0;
  }

  .table-wrap td .button {
    justify-self: stretch;
  }

  .rank-cell {
    width: auto;
    font-size: 20px;
  }

  .check-field {
    justify-content: flex-start;
    min-height: 44px;
  }
}
