/* Dynasty - dossier theme: cream paper, deep-purple structure, gold labels,
   pink accent. Flat colours (no gradients), rounded corners, no glow. */
:root {
  --purple: #37003c;
  --purple-2: #4b0d52;
  --pink: #e90052;
  --green: #1f8c54;
  --green-soft: #eef3e4;
  --cyan: #1796ad;
  --gold: #a98f4f;
  --bg: #f3ecd9;        /* cream paper background */
  --card: #fffdf6;      /* paper card */
  --ink: #241d12;       /* warm near-black ink */
  --muted: #7a6f57;     /* warm grey */
  --faint: #a99f86;
  --line: #e6dcc4;      /* tan rule */
  --bad: #c0143f;
  --warn: #b07400;
  --pitch: #0a9c5a;
  --pitch-2: #0b8f53;
  --r: 12px;
  --r-sm: 8px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(60, 45, 10, 0.05), 0 2px 8px rgba(60, 45, 10, 0.05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }

/* masthead */
.masthead { background: var(--purple); color: #fff; }
.mast-inner { max-width: 760px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: -0.5px; }
.brand-dot { color: var(--pink); }
.brand-club { font-weight: 700; font-size: 13px; color: #d9c7dd; letter-spacing: 0.5px; }

.app { max-width: 760px; margin: 0 auto; padding: 14px 14px 80px; }

/* generic */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.h-lg { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; margin: 2px 0 16px; }
.h-md { font-size: 16px; font-weight: 800; margin: 2px 0 12px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--gold); margin: 16px 2px 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }
.good { color: var(--green); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.right { margin-left: auto; }

/* buttons */
.btn { font-family: var(--font); font-weight: 700; font-size: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 11px 16px; border-radius: var(--r-sm); cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: #f1ead6; }
.btn-primary { background: var(--pink); color: #fff; border-color: var(--pink); }
.btn-primary:hover { background: #cf0049; }
.btn-purple { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-purple:hover { background: var(--purple-2); }
.btn-ghost { background: var(--card); color: var(--muted); }
.btn-bad { background: var(--card); color: var(--bad); border-color: #f6c6d6; }
.btn-bad:hover { background: #fdeff4; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { font-size: 16px; padding: 14px; }
.btn-sm { font-size: 12px; padding: 7px 10px; border-radius: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* setup */
.picker { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { flex: 1; min-width: 110px; border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 700; text-align: center; }
.pick:hover { border-color: #d8cdb0; }
.pick.active { border-color: var(--purple); background: var(--purple); color: #fff; }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.club-opt { border: 1px solid var(--line); background: var(--card); padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer; }
.club-opt:hover { border-color: #d8cdb0; }
.club-opt.active { border-color: var(--purple); box-shadow: inset 0 0 0 1px var(--purple); }
.club-opt .cn { font-weight: 700; font-size: 14px; }
.club-opt .cp { color: var(--pink); font-size: 13px; letter-spacing: 1px; }

/* status bar */
.statusbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; box-shadow: var(--shadow); }
.stat .k { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--gold); }
.stat .v { font-size: 16px; font-weight: 800; margin-top: 3px; }
.stat .v.small { font-size: 14px; }

/* tabs */
.tabbar { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; margin-bottom: 14px; box-shadow: var(--shadow); }
.tab { flex: 1; text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); padding: 9px 6px; border-radius: var(--r-pill); cursor: pointer; border: 0; background: transparent; }
.tab.active { background: var(--purple); color: #fff; }
.toprow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* tables / lists */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--faint); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.me td { background: var(--green-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.pos-badge { display: inline-block; min-width: 30px; text-align: center; font-size: 10px; font-weight: 800; padding: 3px 6px; border-radius: 5px; color: #fff; }
.pos-GK { background: #f0a800; } .pos-DF { background: #00a861; } .pos-MF { background: #04bcd6; } .pos-FW { background: #e90052; }
.ovr-chip { display: inline-block; min-width: 30px; text-align: center; font-weight: 800; font-size: 13px; background: var(--purple); color: #fff; padding: 3px 6px; border-radius: 6px; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; }
.tag.inj { color: var(--bad); border-color: #f6c6d6; background: #fdeff4; }
.tag.exp { color: var(--warn); border-color: #f0dcae; background: #fbf3e0; }
.tag.listed { color: var(--purple); border-color: #d9c7dd; }
.bar { height: 6px; width: 56px; background: #ece3cd; border-radius: 999px; display: inline-block; vertical-align: middle; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }
.name { font-weight: 600; }
.sub { color: var(--faint); font-size: 12px; }

/* inputs */
.inp { font-family: var(--font); font-size: 15px; background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 10px 12px; border-radius: var(--r-sm); outline: none; width: 100%; }
.inp:focus { border-color: var(--purple); }
.field { margin: 10px 0; }
.field .fl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--faint); margin-bottom: 5px; }
.sel { font-family: var(--font); font-size: 14px; background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 9px 10px; border-radius: var(--r-sm); }

/* notices */
.notice { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 10px; background: #fbf7ec; }
.notice.ok { border-color: #bce7d2; background: var(--green-soft); }
.notice.warn { border-color: #f0dcae; background: #fbf3e0; color: #8a5b00; }
.notice.danger { border-color: #f6c6d6; background: #fdeff4; color: #b00040; }
.inbox-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin-bottom: 8px; }

/* ----- pitch (lineup) ----- */
.formrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.formbtn { font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.formbtn.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.pitch {
  position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 560px;
  background: var(--pitch);
  background-image: repeating-linear-gradient(0deg, transparent 0, transparent 9.5%, rgba(255,255,255,0.05) 9.5%, rgba(255,255,255,0.05) 19%);
  border-radius: var(--r); border: 1px solid var(--pitch-2); overflow: hidden;
}
.pitch::before { /* centre circle + halfway line */
  content: ""; position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.25); border-radius: 50%;
}
.pitch::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; border-top: 2px solid rgba(255,255,255,0.18); }
.pbox { position: absolute; left: 26%; right: 26%; height: 13%; border: 2px solid rgba(255,255,255,0.22); border-top: 0; }
.pbox.top { top: 0; border-top: 0; border-bottom: 2px solid rgba(255,255,255,0.22); }
.pbox.bot { bottom: 0; }
.slot { position: absolute; transform: translate(-50%, -50%); width: 76px; text-align: center; cursor: pointer; }
.slot .jersey { width: 42px; height: 42px; margin: 0 auto 4px; border-radius: 10px; background: var(--card); border: 1px solid rgba(0,0,0,0.08); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: var(--purple); box-shadow: var(--shadow); }
.slot.empty .jersey { background: rgba(255,255,255,0.25); border: 2px dashed rgba(255,255,255,0.7); color: #fff; font-size: 20px; }
.slot .nm { font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,0.32); border-radius: 5px; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .ov { display: inline-block; font-size: 10px; font-weight: 800; background: #00a861; color: #fff; border-radius: 4px; padding: 1px 4px; margin-top: 2px; }
.slot.inj .jersey { outline: 2px solid var(--bad); }

/* picker / modal overlay */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(28, 27, 34, 0.5); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 16px 16px 0 0; padding: 16px; max-height: 82vh; overflow-y: auto; }
.modal-wrap { align-items: flex-start; padding: 16px 12px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--card); border-radius: var(--r); padding: 16px; }
.sheet-head, .modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.pickrow { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.pickrow:hover { background: #f1ead6; }
.x { border: 0; background: #ece3cd; width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--muted); }

/* negotiation chat */
.chat { max-height: 44vh; overflow-y: auto; margin-bottom: 12px; }
.msg { margin-bottom: 10px; max-width: 88%; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.msg.them { background: #ece3cd; border-bottom-left-radius: 3px; }
.msg.you { background: var(--purple); color: #fff; margin-left: auto; border-bottom-right-radius: 3px; }
.msg .w { font-size: 10px; font-weight: 700; opacity: 0.7; display: block; margin-bottom: 3px; }
.src { opacity: 0.5; font-weight: 400; }

/* end / season */
.bigscore { font-size: 40px; font-weight: 900; letter-spacing: -1px; }
.foot { margin-top: 18px; color: var(--faint); font-size: 12px; text-align: center; line-height: 1.6; }

/* ----- manager's dossier (paperwork top panel) ----- */
.dossier { background: #fffdf6; border: 1px solid #e7e1cf; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.dossier-top { background: var(--purple); color: #fff; padding: 11px 14px; display: flex; justify-content: space-between; align-items: baseline; }
.dossier-top .dt-club { font-weight: 800; font-size: 15px; }
.dossier-top .dt-sub { font-size: 11px; color: #d9c7dd; font-weight: 600; letter-spacing: 0.3px; }
.dossier-grid { display: grid; grid-template-columns: 1fr 1fr; }
.dossier-grid section { padding: 11px 14px; border-top: 1px solid #efe7d2; border-right: 1px solid #efe7d2; }
.dossier-grid section:nth-child(2n) { border-right: 0; }
.dossier h4 { margin: 0 0 5px; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #a98f4f; }
.dossier p { margin: 0; font-size: 14px; line-height: 1.55; }
.dossier .big { font-size: 18px; font-weight: 800; }
.dossier .kvline { display: flex; justify-content: space-between; }
.dossier .kvline span:first-child { color: var(--muted); }

/* ----- landing ----- */
.landing h1 { font-size: 27px; font-weight: 900; letter-spacing: -0.6px; margin: 6px 0 8px; }
.landing .lead { color: var(--muted); font-size: 15px; margin: 0 0 6px; }
.feat { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.feat .ic { font-size: 20px; line-height: 1.2; }
.feat b { display: block; font-size: 14px; }
.feat .ft { color: var(--muted); font-size: 13px; }
.modepick .pick { padding: 14px 10px; }
.modepick .pick .mt { font-size: 15px; }
.modepick .pick .md { font-size: 12px; font-weight: 500; margin-top: 4px; opacity: 0.9; }

/* ----- start popup ----- */
.clubpop .stars { color: var(--pink); letter-spacing: 2px; font-size: 17px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-of-type { border-bottom: 0; }
.kv .k { color: var(--muted); }

/* ----- collapsible ----- */
.collapse-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.count-badge { display: inline-block; min-width: 20px; text-align: center; background: var(--pink); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 7px; margin-left: 8px; }
.chev { color: var(--muted); font-size: 18px; transition: transform 0.15s; }
.chev.open { transform: rotate(90deg); }

/* ----- bench + drag ----- */
.bench { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 8px; }
.benchcard { border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; background: var(--card); cursor: grab; touch-action: none; }
.benchcard .bn { font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.benchcard .bo { display: inline-block; font-size: 11px; font-weight: 800; background: var(--purple); color: #fff; border-radius: 5px; padding: 1px 6px; margin-top: 4px; }
.benchcard .bp { font-size: 9px; font-weight: 800; }
.slot { touch-action: none; }
.slot.drop-ok .jersey { outline: 3px solid #fff; outline-offset: 1px; }
.bench.drop-ok { outline: 2px dashed var(--purple); outline-offset: 4px; border-radius: 10px; }
.dragclone { position: fixed; z-index: 9999; pointer-events: none; transform: translate(-50%, -50%); }
.dragclone .jersey { width: 44px; height: 44px; border-radius: 10px; background: var(--card); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--purple); box-shadow: 0 8px 18px rgba(0,0,0,0.35); border: 1px solid rgba(0,0,0,0.08); }

@media (max-width: 560px) {
  .statusbar { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none; }
  .slot { width: 64px; }
  .slot .jersey { width: 38px; height: 38px; }
}
