/* The tabletop has its own layer so ordinary HUD updates never rebuild a game. */
#activity[hidden] { display: none; }
#activity { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 14px; }
.ta-shade { position: absolute; inset: 0; background: #1526219e; }
.ta-card {
  --ta-ink: #26382d;
  --ta-green: #355e48;
  --ta-paper: #fdf7e7;
  position: relative; overflow: auto; overscroll-behavior: contain;
  width: min(100%, 470px); max-height: calc(100dvh - 28px);
  padding: 17px; border-radius: 23px; background: var(--ta-paper); color: var(--ta-ink);
  border: 1px solid #e3d6b6; box-shadow: 0 20px 48px #111d1c64;
}
.ta-card-chess { width: min(100%, 520px); }
.ta-card button {
  min-height: 40px; padding: 7px 11px; border: 1px solid #dfd2b4; border-radius: 10px;
  background: #fff9e9; color: #33453a; font-weight: 750;
}
.ta-card button:disabled { opacity: .55; cursor: default; }
.ta-card button:not(:disabled):hover { border-color: #75886d; }
.ta-card button:focus-visible, .ta-card input:focus-visible { outline: 2px solid #357250; outline-offset: 2px; }
.ta-card .ta-primary { background: var(--ta-green); color: #fff9e8; border-color: var(--ta-green); }
.ta-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 13px; }
.ta-head small { color: #697755; font-weight: 800; font-size: 11px; letter-spacing: .06em; }
.ta-head h2 { margin: 2px 0 0; font-size: 26px; line-height: 1.16; }
.ta-head .ta-close { min-width: 42px; background: #efe5ce; }
.ta-venues { display: flex; gap: 6px; margin-bottom: 9px; }
.ta-venues button { min-height: 35px; font-size: 12px; }
.ta-venues button[aria-pressed="true"] { background: #e5edda; border-color: #6d916f; }
.ta-games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ta-games button { min-height: 107px; text-align: left; display: grid; align-content: start; gap: 4px; background: #fbf3de; }
.ta-games button[aria-pressed="true"] { background: #e5edda; border-color: #6d916f; }
.ta-games i { width: 31px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-style: normal; font-size: 19px; background: #d7e4cf; }
.ta-games small, .ta-people p, .ta-story p { color: #596958; font-size: 12px; font-weight: 500; margin: 0; }
.ta-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 14px 0 5px; font-size: 13px; }
.ta-line button { min-height: 36px; padding-inline: 8px; font-size: 11px; }
.ta-people { display: grid; gap: 5px; max-height: 220px; overflow: auto; }
.ta-people button { display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left; }
.ta-people button span { color: #4f735a; font-size: 11px; }
.ta-story { padding: 10px; margin: 9px 0; border: 1px solid #e3d7ba; border-radius: 10px; background: #f6ecd6; }
.ta-story p { margin-top: 3px; }
.ta-acts { display: flex; gap: 7px; justify-content: flex-end; margin-top: 11px; }
.ta-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ta-seats > div { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; border: 1px solid #eadcc0; border-radius: 10px; padding: 7px; }
.ta-seats > div.on-turn { border-color: #6f9473; background: #e6eddd; }
.ta-seats b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ta-seats small { color: #5b6d58; font-size: 10px; }
.ta-seats i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #51412d; background: #373a32; }
.ta-seats i.white { background: #fffae9; border-color: #aa946d; }
.ta-status { margin: 8px 0; text-align: center; color: #395f47; font-size: 13px; font-weight: 850; }
.ta-board-slot {
  padding: 6px; border-radius: 11px; background: #aa7642;
  box-shadow: inset 0 1px #e6b981, 0 4px #744a2e4f;
}
.ta-board {
  display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); grid-template-rows: repeat(15, minmax(0, 1fr));
  width: 100%; aspect-ratio: 1; position: relative; isolation: isolate;
  border-radius: 5px; background: #dfb77f;
}
.ta-board::before {
  content: ""; position: absolute; inset: calc(100% / 30); z-index: -1;
  border-right: 1px solid #826543; border-bottom: 1px solid #826543;
  background-image: linear-gradient(90deg, #826543 1px, transparent 1px), linear-gradient(#826543 1px, transparent 1px);
  background-size: calc(100% / 14) calc(100% / 14);
}
.ta-board::after {
  content: ""; position: absolute; z-index: -1; top: 50%; left: 50%; width: 5px; height: 5px;
  border-radius: 50%; background: #826543; transform: translate(-50%, -50%);
}
.ta-board button, .ta-board button:hover {
  display: grid; place-items: center; min-height: 0; padding: 0; border: 0;
  border-radius: 2px; background: transparent; touch-action: manipulation;
}
.ta-board button:focus-visible { outline-offset: -2px; }
.ta-board button[aria-disabled="true"] { cursor: default; }
.ta-board button::after { content: ""; width: 78%; aspect-ratio: 1; border-radius: 50%; }
@media (hover: hover) {
  .ta-board button[aria-disabled="false"]:hover::after { background: #4d66575c; }
}
.ta-board button.black::after { background: radial-gradient(circle at 32% 30%, #576259, #1e2822 70%); box-shadow: 0 1px 2px #4c362f80; }
.ta-board button.white::after { background: radial-gradient(circle at 32% 30%, #fffef5, #e3d8bf 75%); box-shadow: 0 1px 2px #4c362f80; }
.ta-board button.latest::after { outline: 2px solid #a14e3b; }
.ta-board button.won::after { outline: 2px solid #467958; }
.ta-word, .ta-score { display: grid; gap: 5px; text-align: center; padding: 16px 7px; border-radius: 11px; background: #e6eddb; }
.ta-word small, .ta-word span, .ta-score span { color: #576c55; font-size: 12px; }
.ta-word strong, .ta-score strong { color: #315a40; font-size: 29px; line-height: 1.15; }
.ta-score small { font-size: 15px; margin-left: 4px; }
.ta-clue, .ta-feedback, .ta-guesses, .ta-notice { margin: 8px 0; overflow-wrap: anywhere; font-size: 12px; }
.ta-clue, .ta-notice { padding: 8px; border-radius: 8px; background: #f3e5c9; }
.ta-form { display: flex; gap: 6px; margin-top: 8px; }
.ta-form input {
  min-width: 0; flex: 1; min-height: 42px; padding: 7px 9px; font: inherit;
  color: #26382d; border: 1px solid #dcccaa; border-radius: 9px; background: #fffdf4;
}
.ta-word-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 7px; font-size: 11px; color: #536652; }
#ui .activity-entry {
  position: absolute; right: 16px; bottom: calc(var(--above-dock, 84px) + 7px); z-index: 724;
  min-height: 43px; display: flex; align-items: center; gap: 6px; padding: 6px 11px 6px 7px;
  border-radius: 12px; border: 1px solid #b7c7a7; background: #f6f5dd; color: #315b45;
  box-shadow: 0 4px 12px #24332b4d; font-size: 13px;
}
.activity-entry i { font-style: normal; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: #dfe9ce; }
body[data-place="room"] #ui .activity-entry { bottom: calc(var(--above-dock, 84px) + 118px); }
body[data-place="talent"] #ui .activity-entry { bottom: calc(var(--above-dock, 84px) + 74px); }
body[data-place="tablevisit"] #ui .activity-entry { bottom: calc(15px + var(--safe-b, 0px)); }
@media (max-width: 640px) {
  #activity { padding: 8px; }
  .ta-card { padding: 11px; max-height: calc(100dvh - 16px); border-radius: 16px; }
  .ta-head { margin-bottom: 8px; }
  .ta-head h2 { font-size: 22px; }
  .ta-form input { font-size: 16px; }
  body[data-place="room"] #ui .activity-entry { bottom: calc(var(--above-dock, 84px) + 98px); }
}

.ta-solo-story {
  margin: 0 0 6px; padding: 8px 10px; border-left: 3px solid #b37d4c; border-radius: 4px 9px 9px 4px;
  color: #594b3a; background: #f6ecd5; font-size: 12px; line-height: 1.45;
}
.ta-solo-story b { display: block; color: #7e512e; }
.ta-solo-task {
  margin: 6px 0; padding: 6px 9px; border-radius: 7px;
  background: #e9eedb; color: #315442; font-size: 13px; font-weight: 750;
}
.ta-solo-task.solved { background: #dfead2; }
.ta-solo .ta-board button.won:not(.black):not(.white)::after { width: 43%; outline: 1px dashed #37654c; }
/* Keep the close button and the board in the visible viewport. */
.ta-solo { width: min(100%, clamp(268px, calc(100dvh - 245px), 430px)); }
.ta-solo .ta-head { position: sticky; top: 0; z-index: 1; background: var(--ta-paper); }
@media (min-width: 850px) {
  #activity:has(.ta-solo) { justify-items: end; padding-right: clamp(20px, 5vw, 85px); }
  #activity:has(.ta-solo) .ta-shade { background: #1d2a2748; }
}

.ta-games:has([data-value="badminton"]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 350px) {
  .ta-games:has([data-value="badminton"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Small-table match: tactile stones, a quiet wood surface, readable turns. */
.ta-games:has([data-value="badminton"]) {grid-template-columns:repeat(2,minmax(0,1fr))}
.ta-games button{min-height:140px;padding:17px;border-radius:16px;background:linear-gradient(145deg,#fff9e9,#ede0c4);box-shadow:0 4px #b6a98855}
.ta-games i{width:46px;height:46px;font-size:30px;background:#405d4b;color:#fff4da;border-radius:50%}
.ta-games button[data-value="badminton"] i{background:#bc704a}.ta-games button[aria-pressed=true]{border:2px solid #50765b;background:#e2ecd7}
.ta-card-chess,.ta-solo{width:min(100%,640px);padding:20px;background:linear-gradient(155deg,#fff9eb,#ece5d0);border:1px solid #d1c5a5;box-shadow:0 12px 0 #273e3466,0 28px 90px #10221a80}
#activity:has(.ta-card-chess){justify-items:center}
.ta-card-chess .ta-head h2{font-size:clamp(24px,4vw,32px)}
.ta-card-chess .ta-status{background:#315343;color:#fff9e6;padding:10px;border-radius:12px;letter-spacing:.04em}
.ta-card-chess .ta-seats{margin:9px 0}.ta-card-chess .ta-seats>div{padding:11px;background:#ede6d1;border:1px solid #d5c9ac;transition:background .2s,border-color .2s}
.ta-card-chess .ta-seats>div.on-turn{background:#dfebd6;border:2px solid #63885e;box-shadow:0 2px 9px #466c3520}
.ta-seats i,.ta-match-strip i{display:inline-block;width:21px;height:21px;flex-shrink:0;border-radius:50%;background:radial-gradient(circle at 32% 25%,#64736b,#14231e 75%);box-shadow:0 2px 3px #17221b55;border:1px solid #304334}
.ta-seats i.white,.ta-match-strip i.white{background:radial-gradient(circle at 32% 25%,#fffef7,#e1d2b5 75%);border-color:#aa9b7d}
.ta-match-strip{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:11px 0;font-size:12px;color:#5d6b55}.ta-match-strip span{display:flex;align-items:center;gap:7px}.ta-match-strip b{font-variant-numeric:tabular-nums}
.ta-board-slot{position:relative;width:min(100%,520px);box-sizing:border-box;margin:12px auto;padding:13px;border:1px solid #a06d37;border-radius:16px;background:linear-gradient(130deg,#d6a763,#88552a 42%,#c38f4d);box-shadow:inset 0 2px #fff0c391,0 6px 0 #714928,0 12px 19px #523f2430}
.ta-board{border-radius:6px;background:repeating-linear-gradient(3deg,#ffffff06 0 2px,#7e4c1706 2px 5px),linear-gradient(115deg,#eed09b,#dbb375 45%,#e7c48a);box-shadow:inset 0 0 17px #9a69273d}
.ta-board::before{border-color:#86674399;background-image:linear-gradient(90deg,#86674399 1px,transparent 1px),linear-gradient(#86674399 1px,transparent 1px)}
.ta-board::after{width:100%;height:100%;inset:0;transform:none;border-radius:0;background:radial-gradient(circle at 23.333% 23.333%,#735334 0 2px,transparent 2.5px),radial-gradient(circle at 76.667% 23.333%,#735334 0 2px,transparent 2.5px),radial-gradient(circle at 23.333% 76.667%,#735334 0 2px,transparent 2.5px),radial-gradient(circle at 76.667% 76.667%,#735334 0 2px,transparent 2.5px),radial-gradient(circle at 50% 50%,#735334 0 2px,transparent 2.5px);pointer-events:none}
.ta-board button::after{content:attr(data-number);display:grid;place-items:center;font-size:clamp(8px,1.8vw,12px);font-weight:700;width:88%;box-sizing:border-box}
.ta-board button.black::after{color:#f8efd6;background:radial-gradient(ellipse at 32% 22%,#69736c 0,#35483f 26%,#14241d 75%,#0a1813);box-shadow:0 2px 2px #241a1477,inset 0 1px #ffffff4d}
.ta-board button.white::after{color:#5c4b31;background:radial-gradient(ellipse at 32% 22%,#fffef7,#f5ebd6 45%,#cdbf9f);box-shadow:0 2px 2px #241a1466,inset 0 1px white}
.ta-board button.latest::after{outline:2px solid #b16542;outline-offset:1px;animation:ta-stone-drop .22s ease-out}
.ta-board button.won::after{outline:2px solid #faf0a5;box-shadow:0 0 11px #fff5a8,0 2px 3px #241a1477}
.ta-board button.pending::after{background:#315b4666;outline:2px dashed #315b46;outline-offset:1px}
@media(hover:hover){.ta-board[data-color="black"] button[aria-disabled=false]:hover::after{background:radial-gradient(circle at 32% 25%,#68796a99,#192d2299)}.ta-board[data-color="white"] button[aria-disabled=false]:hover::after{background:#fff8deb3}}
.ta-win-line{position:absolute;inset:13px;width:calc(100% - 26px);height:calc(100% - 26px);pointer-events:none;filter:drop-shadow(0 0 3px #fff2a0)}.ta-win-line line{stroke:#fff1a2;stroke-width:.8;stroke-linecap:round;stroke-dasharray:150;stroke-dashoffset:0;animation:ta-connect .6s ease-out}
.ta-chess-tools{display:flex;justify-content:center;gap:7px;flex-wrap:wrap;margin:17px 0 8px}.ta-chess-tools button{font-size:12px;min-height:38px;background:#eae2cb}.ta-chess-tools button[aria-pressed=true]{background:#3e604c;color:#fff5dc}
.ta-confirm{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:9px;border-radius:12px;background:#dfebd6;font-size:12px}.ta-board-help{text-align:center;font-size:11px;color:#727b62;margin:8px 0}
.ta-chess-result{display:grid;text-align:center;gap:5px;padding:16px;margin:9px 0;background:linear-gradient(120deg,#ead9a9,#f8edcc);border:1px solid #c6a96b;border-radius:14px;animation:ta-stone-drop .3s ease-out}.ta-chess-result strong{font-size:24px;color:#355340}.ta-chess-result small,.ta-chess-result span{font-size:11px;color:#786743}
@keyframes ta-stone-drop{from{transform:translateY(-7px) scale(1.18);opacity:.35}to{transform:translateY(0) scale(1);opacity:1}}@keyframes ta-connect{from{stroke-dashoffset:150}to{stroke-dashoffset:0}}
@media(max-width:640px){.ta-card-chess,.ta-solo{padding:12px;width:100%}.ta-board-slot{padding:9px;border-radius:12px}.ta-win-line{inset:9px;width:calc(100% - 18px);height:calc(100% - 18px)}.ta-card-chess .ta-seats>div{padding:8px}.ta-head h2{font-size:24px}.ta-chess-result{padding:11px}.ta-chess-result strong{font-size:21px}}
@media(prefers-reduced-motion:reduce){.ta-board button.latest::after,.ta-win-line line,.ta-chess-result{animation:none}}
.ta-practice-entry{display:flex;align-items:center;gap:12px;padding:13px 0;border-bottom:1px solid #e5d8bc}.ta-practice-entry small{font-size:11px;color:#697755}
#activity:has(.ta-card-chess) .ta-shade{background:radial-gradient(ellipse at 50% 40%,#213d2455,#10251edb)}
.ta-win-line{z-index:3}
.ta-card-chess:has(.ta-chess-result) .ta-board-slot{width:min(100%,max(210px,calc(100dvh - 490px)))}
body:has(#activity:not([hidden])) .game-audio-menu{visibility:hidden}
