/* Aile Yarışması. Scoped under .aile; no emoji.
   Palette: the app's own dark surfaces, one paper tone for what has been found, and two soft team colours.
   Nothing is boxed unless it is a thing you press or type into. */
.aile {
  --aile-a: #7fa8e6;          /* Mavi Aile */
  --aile-b: #e59a80;          /* Kırmızı Aile */
  --aile-paper: #ebe5d5;      /* a found answer, the primary button */
  --aile-ink: #1d2027;
  --aile-miss: #e5705f;       /* strikes, wrong */
  max-width: 1040px; margin: 8px auto 40px; padding: 8px 4px 0;
  display: flex; flex-direction: column; gap: 14px;
}
.aile[hidden], .aile [hidden] { display: none !important; }
.aile .mono { font-variant-numeric: tabular-nums; }

/* ---- scoreboard */
.aile-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px; }
.aile-team { --tc: var(--aile-a); display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 3px solid transparent; min-width: 0; transition: border-color .3s; }
.aile-team.b { --tc: var(--aile-b); align-items: flex-end; text-align: right; }
.aile-team.control, .aile-team.steal { border-bottom-color: var(--tc); }
.aile-tname { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--tc); }
.aile-tname::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tc); flex: none; }
.aile-team.b .aile-tname { flex-direction: row-reverse; }
.aile-team.mine .aile-tname::after { content: "senin ailen"; font-weight: 500; font-size: 13px; color: var(--muted); }
.aile-team.b.mine .aile-tname::after { order: -1; }
.aile-score { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -.02em; color: var(--text); }
.aile-members { display: flex; flex-wrap: wrap; gap: 4px; min-height: 30px; }
.aile-team.b .aile-members { justify-content: flex-end; }
.aile-m { display: inline-flex; border-radius: 50%; padding: 2px; transition: box-shadow .2s, opacity .2s; }
.aile-m .avatar { width: 28px; height: 28px; font-size: 11px; border: 0; }
.aile-m.rep { box-shadow: 0 0 0 2px var(--surface-hover), 0 0 0 3px var(--tc); }
.aile-m.turn { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.aile-m.away { opacity: .3; }

.aile-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 8px; min-width: 130px; }
.aile-round { font-size: 14px; color: var(--muted); }
.aile-bank { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.aile-bank b { font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.aile-bank span { margin-top: 4px; font-size: 13px; color: var(--muted); }
.aile-mult { font-size: 13px; font-weight: 600; color: var(--aile-paper); }

/* ---- question and clock */
.aile-q { text-align: center; font-size: clamp(20px, 2.4vw, 28px); font-weight: 600; line-height: 1.25; text-wrap: balance; padding: 4px 12px 0; }
.aile-timer { display: flex; align-items: center; gap: 14px; margin-top: -8px; }
.aile-bar { flex: 1; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.aile-bar i { display: block; height: 100%; width: 100%; background: var(--text-2); transition: width .25s linear, background .2s; }
.aile-timer b { min-width: 28px; text-align: right; font-size: 15px; font-weight: 500; color: var(--muted); }
.aile-timer.low .aile-bar i { background: var(--aile-miss); }
.aile-timer.low b { color: var(--aile-miss); }
.aile-caption { text-align: center; font-size: 15px; color: var(--muted); min-height: 22px; margin-top: -10px; }

/* ---- board */
.aile-board { display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows, 4), 56px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; perspective: 1000px; }
.aile-tile { position: relative; }
.aile-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .2, 1); }
.aile-tile.open .aile-in { transform: rotateX(180deg); }
.aile-face { position: absolute; inset: 0; border-radius: 12px; display: flex; align-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.aile-face.front { background: var(--surface-2); padding-left: 22px; }
.aile-face.front .rk { font-size: 24px; font-weight: 600; color: var(--faint); }
.aile-face.back { transform: rotateX(180deg); justify-content: space-between; gap: 16px; padding: 0 22px; background: var(--aile-paper); color: var(--aile-ink); }
.aile-face.back .tx { font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aile-face.back .pt { font-size: 26px; font-weight: 700; }
.aile-tile.missed .aile-face.back { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--border-strong); }
.aile-tile .peek { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); z-index: 2; pointer-events: none; font-size: 16px; color: var(--text-2); max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aile-tile .peek:empty { display: none; }

/* ---- strikes */
.aile-status { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.aile-x { width: 24px; height: 24px; color: var(--border-strong); transition: color .2s, transform .2s; }
.aile-x svg { width: 100%; height: 100%; }
.aile-x.on { color: var(--aile-miss); animation: aile-strike .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes aile-strike { 0% { transform: scale(.4); } 100% { transform: none; } }

/* ---- what to do now */
.aile-action { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.aile-action:empty { display: none; }
.aile-action > * { width: 100%; }
.aile-note { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.aile-note b { font-size: 20px; font-weight: 600; }
.aile-note span { font-size: 16px; color: var(--muted); }
.aile-hint, .aile-count { text-align: center; font-size: 16px; color: var(--muted); }
.aile-count b { color: var(--text); font-weight: 600; }
.aile-survey { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.aile-badge { text-align: center; font-size: 14px; color: var(--muted); }
.aile-badge.a b { color: var(--aile-a); } .aile-badge.b b { color: var(--aile-b); }

.aile-answer { display: flex; flex-direction: column; gap: 8px; }
.aile-answer label { font-size: 15px; color: var(--muted); }
.aile-field { display: flex; gap: 10px; }
.aile-field input { flex: 1; min-width: 0; height: 56px; padding: 0 18px; font-size: 18px; font-family: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; }
.aile-field input:focus { outline: none; border-color: var(--text-2); }
.aile-field input:disabled { opacity: .55; }
.aile-field input::placeholder { color: var(--faint); }

.aile-btn { height: 56px; padding: 0 28px; border: 0; border-radius: 14px; font-size: 17px; font-weight: 600; font-family: inherit; cursor: pointer; transition: opacity .15s, transform .1s; }
.aile-btn:active:not(:disabled) { transform: translateY(1px); }
.aile-btn:disabled { opacity: .4; cursor: not-allowed; }
.aile-btn.gold { background: var(--aile-paper); color: var(--aile-ink); }   /* "gold" is the primary button */
.aile-btn.gold:hover:not(:disabled) { opacity: .9; }
.aile-btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.aile-btn.ghost:hover:not(:disabled) { background: var(--surface); }
.aile-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.aile-link { background: none; border: 0; padding: 4px 2px; font-size: 14px; font-family: inherit; color: var(--muted); cursor: pointer; }
.aile-link:hover { color: var(--text); }
.aile-link.danger:hover { color: var(--aile-miss); }

/* duel */
.aile-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.aile-rep { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; min-width: 0; padding-bottom: 8px; border-bottom: 3px solid transparent; }
.aile-rep.b { flex-direction: row-reverse; text-align: right; }
.aile-rep.first { border-bottom-color: var(--text); }
.aile-rep span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aile-rep .avatar { width: 48px; height: 48px; font-size: 16px; border: 0; flex: none; }
.aile-rep.a .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--aile-a); }
.aile-rep.b .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--aile-b); }
.aile-vsmark { font-size: 14px; color: var(--faint); }
.aile-buzz { align-self: center; width: 116px; height: 116px; border-radius: 50%; border: 0; cursor: pointer; background: var(--aile-paper); color: var(--aile-ink);
  font-size: 26px; font-weight: 700; font-family: inherit; letter-spacing: .06em; transition: transform .1s; }
.aile-buzz:hover:not(:disabled) { transform: scale(1.03); }
.aile-buzz:active:not(:disabled) { transform: scale(.96); }
.aile-buzz:disabled { opacity: .4; }

.aile-turn { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 18px; }
.aile-turn .avatar { width: 36px; height: 36px; font-size: 13px; border: 0; }
.aile-turn.me { font-weight: 600; }

.aile-result { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.aile-result span { font-size: 18px; }
.aile-result b { font-size: 56px; font-weight: 700; line-height: 1.1; color: var(--aile-paper); animation: aile-pop .5s cubic-bezier(.3, 1.5, .5, 1); }
.aile-result small { font-size: 15px; color: var(--muted); }
@keyframes aile-pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* lobby */
.aile-lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 100%; }
.aile-lobby .aile-col { padding: 0 24px; min-width: 0; }
.aile-col.a { --tc: var(--aile-a); border-right: 1px solid var(--border); }
.aile-col.b { --tc: var(--aile-b); }
.aile-col h4 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--tc); }
.aile-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 16px; min-width: 0; }
.aile-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aile-row .avatar { width: 32px; height: 32px; font-size: 12px; border: 0; }
.aile-row .aile-link { opacity: 0; transition: opacity .15s; }
.aile-row:hover .aile-link, .aile-row:focus-within .aile-link { opacity: 1; }
.aile-start { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

/* end */
.aile-final { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; text-align: center; }
.aile-final h3 { margin: 0; font-size: 30px; font-weight: 600; }
.aile-kicker { font-size: 14px; color: var(--muted); }
.aile-fscore { display: flex; align-items: baseline; gap: 18px; font-size: 56px; font-weight: 700; margin: 4px 0 10px; }
.aile-fscore i { font-style: normal; color: var(--faint); }
.aile-fscore b.a { color: var(--aile-a); } .aile-fscore b.b { color: var(--aile-b); }
.aile-final .aile-btn { width: auto; min-width: 160px; }

/* the last thing that happened, and the presenter's tools */
.aile-feed { list-style: none; margin: 0; padding: 0; text-align: center; font-size: 15px; color: var(--muted); min-height: 0; }
.aile-feed:empty { display: none; }
.aile-feed b { color: var(--text-2); font-weight: 600; }
.aile-feed em { font-style: normal; color: var(--text); }
.aile-feed em.bad { color: var(--aile-miss); }
.aile-hostbar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 22px; padding-top: 14px; border-top: 1px solid var(--border); }
.aile-hostbar .aile-kicker { margin-right: 4px; }
.aile-fix { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.aile-fix select { max-width: 220px; height: 34px; padding: 0 8px; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; font-family: inherit; }

@media (max-height: 940px) {
  .aile-board { grid-template-rows: repeat(var(--rows, 4), 48px); gap: 6px 16px; }
  .aile-face.back .tx { font-size: 18px; }
  .aile-q { font-size: clamp(18px, 2vw, 24px); }
}

/* chat state set from js/room/chat-panel.js while the audience answers */
.chat.is-answer .chat-status { color: var(--text-2); }

@media (max-width: 760px) {
  .aile { gap: 18px; }
  .aile-top { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .aile-mid { grid-column: 1 / -1; order: -1; flex-direction: row; justify-content: center; gap: 16px; padding-bottom: 0; }
  .aile-bank { flex-direction: row; gap: 8px; align-items: baseline; }
  .aile-bank span { margin: 0; }
  .aile-score { font-size: 44px; }
  .aile-board { grid-auto-flow: row; grid-template-columns: 1fr; grid-template-rows: none; grid-auto-rows: 60px; gap: 10px; }
  .aile-face.back .tx { font-size: 18px; }
  .aile-lobby { grid-template-columns: 1fr; gap: 16px; }
  .aile-lobby .aile-col { border: 0 !important; padding: 0; }
  .aile-row .aile-link { opacity: 1; }
  .aile-vs { gap: 10px; }
  .aile-rep .avatar { width: 40px; height: 40px; }
}
