/* KB Potato workbench refresh — loaded last to unify the existing feature layers. */
:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-soft: #f3eee3;
  --ink: #21342e;
  --muted: #6f7870;
  --line: #ded8ca;
  --brand: #34745f;
  --brand-dark: #215443;
  --accent: #db9d45;
  --danger: #b94b43;
  --crayon-red: #e85d4f;
  --crayon-blue: #56a7d8;
  --crayon-yellow: #f2c94c;
  --shadow-card: 0 1px 2px rgba(40, 53, 45, 0.05), 0 12px 32px rgba(61, 68, 55, 0.07);
  --shadow-hover: 0 2px 4px rgba(40, 53, 45, 0.06), 0 18px 40px rgba(61, 68, 55, 0.12);
  --brand-gradient: linear-gradient(135deg, #3d816b, #28634f);
  --brand-gradient-hover: linear-gradient(135deg, #488d76, #2e6e58);
  --focus-ring: 0 0 0 3px rgba(52, 116, 95, 0.2);
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(circle at 12% 2%, rgba(226, 166, 81, 0.13), transparent 28rem),
    radial-gradient(circle at 86% 10%, rgba(52, 116, 95, 0.1), transparent 32rem),
    linear-gradient(180deg, #f8f5ee 0%, var(--bg) 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M0 79.5h80M79.5 0v80' stroke='%23858b7e' stroke-opacity='.12'/%3E%3C/svg%3E");
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9000;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  top: 0;
  padding-top: 12px;
  background: linear-gradient(180deg, rgba(248, 245, 238, 0.96), rgba(248, 245, 238, 0.72) 70%, transparent);
}

.module-bar {
  min-height: 58px;
  padding: 8px 10px 8px 12px;
  border-color: rgba(126, 119, 101, 0.22);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(18px) saturate(1.2);
}

.brand-lockup,
.brand-lockup > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-lockup img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 5px 14px rgba(95, 72, 38, 0.15);
}

.module-brand {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.module-current {
  position: relative;
  padding-left: 10px;
  color: var(--muted);
}

.module-current::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}

.module-nav {
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(126, 119, 101, 0.15);
  border-radius: 13px;
  background: rgba(243, 238, 227, 0.72);
}

.module-nav a {
  min-width: 76px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
}

.module-nav a.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(61, 68, 55, 0.09);
}

.stealth-nav button,
.stealth-nav .mode-chip {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.stealth-nav button:hover {
  background: var(--surface-soft);
  color: var(--brand-dark);
}

.mode-chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #5f9f75;
  box-shadow: 0 0 0 4px rgba(95, 159, 117, 0.12);
}

.game-section,
.toolbox-section,
.ai-section,
.community-section {
  width: min(1180px, calc(100% - 32px));
}

.section-head {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
  min-height: 470px;
  margin-top: 22px;
  padding: 14px;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(126, 119, 101, 0.2);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.52);
  box-shadow: var(--shadow-card);
}

.fish-console {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 440px;
  padding: clamp(26px, 4vw, 58px);
  overflow: hidden;
  border-radius: 21px;
  background:
    radial-gradient(circle at 86% 14%, rgba(219, 157, 69, 0.26), transparent 16rem),
    linear-gradient(145deg, #274d40 0%, #17372d 100%);
  color: #fffdf7;
}

.fish-console::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -85px;
  width: 290px;
  height: 290px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 48% 52% 56% 44%;
  transform: rotate(18deg);
  box-shadow: inset 0 0 0 38px rgba(255, 255, 255, 0.025), inset 0 0 0 76px rgba(255, 255, 255, 0.02);
}

.crayon-doodles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.crayon-sun {
  position: absolute;
  top: 42px;
  left: 42px;
  width: 34px;
  height: 34px;
  border: 5px solid var(--crayon-yellow);
  border-radius: 48% 52% 46% 54%;
  opacity: 0.8;
  transform: rotate(-8deg);
  filter: drop-shadow(1px 2px 0 rgba(14, 42, 34, 0.24));
}

.crayon-sun > i {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #fff1b3;
  font-family: "Comic Sans MS", "KaiTi", cursive;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: -0.06em;
  text-shadow: 1px 1px 0 rgba(74, 54, 11, 0.36);
}

.crayon-sun::before,
.crayon-sun::after,
.crayon-sun i::before,
.crayon-sun i::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 58px;
  height: 4px;
  border-radius: 999px;
  background: var(--crayon-yellow);
  transform: translate(-50%, -50%);
}

.crayon-sun::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.crayon-sun i::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.crayon-sun i::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.crayon-star {
  position: absolute;
  color: var(--crayon-yellow);
  font-family: "Comic Sans MS", "KaiTi", cursive;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(11, 41, 32, 0.28);
}

.crayon-star-one {
  top: 34px;
  left: 45%;
  font-size: 24px;
  transform: rotate(14deg);
}

.crayon-star-two {
  right: 20px;
  bottom: 38%;
  color: var(--crayon-blue);
  font-size: 18px;
  transform: rotate(-18deg);
}

.crayon-stroke {
  position: absolute;
  width: 132px;
  height: 38px;
  border: 6px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  opacity: 0.58;
}

.crayon-stroke::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 10px;
  width: 105px;
  border-top: 3px dashed currentColor;
  border-radius: 50%;
  transform: rotate(-2deg);
}

.crayon-stroke-red {
  right: 30%;
  bottom: 25px;
  color: var(--crayon-red);
  transform: rotate(-8deg);
}

.crayon-stroke-blue {
  top: 45%;
  right: -35px;
  color: var(--crayon-blue);
  transform: rotate(78deg);
}

.crayon-loop {
  position: absolute;
  left: -38px;
  bottom: 82px;
  width: 118px;
  height: 74px;
  border: 5px solid var(--crayon-red);
  border-left-color: transparent;
  border-radius: 50%;
  opacity: 0.38;
  transform: rotate(18deg);
}

.hero-visual {
  position: absolute;
  z-index: 1;
  top: 28px;
  right: 28px;
  display: grid;
  width: clamp(180px, 18vw, 260px);
  aspect-ratio: 1;
  place-items: center;
}

.hero-visual img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 22px 34px rgba(8, 28, 22, 0.32));
  animation: mascot-float 5s ease-in-out infinite;
}

.hero-orbit {
  position: absolute;
  inset: -8px;
  border: 1px dashed rgba(239, 189, 105, 0.3);
  border-radius: 50%;
  animation: mascot-orbit 22s linear infinite;
}

.hero-orbit::before,
.hero-orbit::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 7px rgba(219, 157, 69, 0.12);
}

.hero-orbit::before {
  top: 13%;
  left: 10%;
}

.hero-orbit::after {
  right: 4%;
  bottom: 22%;
}

.hero-visual-note {
  position: absolute;
  z-index: 3;
  right: -8px;
  bottom: 6px;
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(22, 56, 45, 0.78);
  color: #fff;
  box-shadow: 0 12px 26px rgba(8, 28, 22, 0.25);
  backdrop-filter: blur(10px);
}

.hero-visual-note strong {
  font-size: 12px;
}

.hero-visual-note small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
}

.hero-badge {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 9px;
  margin-bottom: 26px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.hero-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e4ad5b;
  box-shadow: 0 0 0 5px rgba(228, 173, 91, 0.13);
}

.fish-console .section-kicker {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.15em;
}

.fish-console .section-kicker b {
  display: inline-grid;
  min-width: 25px;
  min-height: 20px;
  margin-right: 5px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.54);
  border-radius: 48% 42% 51% 44%;
  color: var(--crayon-yellow);
  font-size: 10px;
  transform: rotate(-3deg);
}

.fish-console h1 {
  position: relative;
  z-index: 1;
  max-width: 58%;
  margin: 0;
  color: #fff;
  font-size: clamp(42px, 4vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.fish-console h1 span {
  color: #e8b665;
}

.fish-console .section-copy {
  position: relative;
  z-index: 1;
  max-width: 55%;
  margin: 18px 0 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  line-height: 1.8;
}

.defense-team {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin-bottom: 22px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
}

.defense-team strong {
  margin-right: 2px;
  color: #fff;
  font-size: 10px;
}

.defense-team small {
  margin-left: 3px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 8px;
}

.team-dot {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 48% 52% 44% 56%;
  box-shadow: 1px 1px 0 rgba(5, 26, 19, 0.36);
}

.team-red { background: #ed5b4f; transform: rotate(8deg); }
.team-blue { background: #55a8db; transform: rotate(-7deg); }
.team-pink { background: #ed8fb4; transform: rotate(5deg); }
.team-green { background: #76bd67; transform: rotate(-4deg); }
.team-yellow { background: #f2c94c; transform: rotate(9deg); }

.fish-actions {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.fish-actions button,
.fish-actions button:nth-child(n) {
  position: relative;
  min-height: 100px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.fish-actions button::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 10px;
  left: 14px;
  height: 3px;
  border-radius: 60% 40% 55% 45%;
  background: var(--crayon-yellow);
  opacity: 0.6;
  transform: rotate(-1deg) scaleX(0.72);
  transform-origin: left;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.fish-actions button:nth-child(2)::after {
  background: var(--crayon-red);
  transform: rotate(1deg) scaleX(0.72);
}

.fish-actions button:nth-child(3)::after {
  background: var(--crayon-blue);
}

.fish-actions button:nth-child(4)::after {
  background: #8bcf72;
  transform: rotate(1.5deg) scaleX(0.72);
}

.fish-actions button:hover::after {
  opacity: 0.95;
  transform: rotate(0) scaleX(1);
}

.fish-actions button:hover {
  border-color: rgba(232, 182, 101, 0.55);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-3px);
}

.fish-actions i {
  display: grid;
  width: 25px;
  height: 25px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 8px;
  background: rgba(232, 182, 101, 0.14);
  color: #f1c77f;
  font-style: normal;
  font-size: 12px;
}

.fish-actions strong {
  color: #fff;
  font-size: 14px;
}

.fish-actions span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.feature-strip {
  display: none;
}

.connection-box {
  align-self: stretch;
  padding: 20px;
  border: 0;
  border-radius: 21px;
  background: var(--surface);
  box-shadow: none;
}

.connection-box:hover {
  transform: none;
  box-shadow: none;
}

.lobby-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.lobby-heading > div {
  display: grid;
  gap: 3px;
}

.lobby-heading strong {
  font-size: 19px;
}

.panel-label {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.live-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa89e;
}

.live-indicator[data-state="connecting"] i {
  background: var(--accent);
  animation: status-pulse 1.1s ease-in-out infinite;
}

.live-indicator[data-state="online"] {
  color: var(--brand);
}

.live-indicator[data-state="online"] i {
  background: #57a172;
  box-shadow: 0 0 0 4px rgba(87, 161, 114, 0.12);
}

.live-indicator[data-state="error"] i {
  background: var(--danger);
}

.stealth-panel {
  margin-bottom: 16px;
  padding: 13px;
  border: 1px solid rgba(52, 116, 95, 0.13);
  border-radius: 13px;
  background: #f2f6f1;
}

.stealth-panel > div:first-child strong {
  color: var(--brand-dark);
}

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

.stealth-actions {
  gap: 5px;
}

.stealth-actions button {
  padding: 7px 9px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.7);
}

.connection-row {
  grid-template-columns: 0.8fr 1fr;
  gap: 10px;
}

.connection-row label {
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.connection-row input,
.chat-input-row input,
textarea,
select {
  border-color: var(--line);
  border-radius: 11px;
  background: #fbfaf6;
}

.connection-row .primary {
  grid-column: 1 / -1;
  min-height: 45px;
  border: 0;
  border-radius: 12px;
  background: var(--brand-gradient);
  box-shadow: 0 8px 18px rgba(33, 84, 67, 0.18);
}

.room-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

.room-actions button,
.bot-toggle {
  min-height: 36px;
  padding: 7px 6px;
  border-color: var(--line);
  border-radius: 9px;
  background: #fbfaf6;
  color: var(--brand-dark);
  font-size: 11px;
}

.bot-toggle {
  grid-column: span 2;
}

.connection-status {
  position: relative;
  margin: 12px 0 0;
  padding: 10px 12px 10px 29px;
  border: 0;
  border-radius: 10px;
  background: #f2eee5;
  color: var(--muted);
  font-size: 11px;
}

.connection-status::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa89e;
  transform: translateY(-50%);
}

.room-help {
  margin-top: 9px;
  padding: 0;
  border-top: 0;
  color: var(--muted);
  font-size: 11px;
}

.room-help summary {
  padding: 7px 2px;
  color: var(--brand-dark);
  cursor: pointer;
}

.room-help span {
  margin: 3px 0;
  padding-left: 18px;
}

.game-overview {
  margin-top: 14px;
  gap: 1px;
  padding: 1px;
  overflow: hidden;
  border-color: rgba(126, 119, 101, 0.2);
  border-radius: 17px;
  background: var(--line);
}

.game-overview > div {
  border: 0;
  background: rgba(255, 253, 248, 0.96);
}

.game-overview strong,
.info-panel h2,
.tool-card h2,
.community-card h2 {
  color: var(--brand-dark);
}

.game-shell,
.info-panel,
.tool-card,
.community-card,
.toolbox-note,
.community-note {
  border-color: rgba(126, 119, 101, 0.2);
  background: rgba(255, 253, 248, 0.9);
}

.game-shell {
  margin-top: 14px;
  overflow: hidden;
  border-radius: 22px;
}

.game-menu {
  border-right-color: var(--line);
  background: #f0ece2;
}

.game-tab {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.game-tab.active {
  border-color: rgba(52, 116, 95, 0.15);
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 6px 16px rgba(61, 68, 55, 0.08);
}

.game-icon,
.tool-icon {
  border-color: rgba(52, 116, 95, 0.16);
  background: #edf3ee;
  color: var(--brand);
}

.game-stage {
  background: rgba(255, 253, 248, 0.84);
}

.panel-head,
.chat-panel,
.info-panel {
  border-color: var(--line);
  background: var(--surface);
}

.primary,
.chat-input-row button {
  border-color: transparent;
  background: var(--brand-gradient);
  box-shadow: 0 7px 16px rgba(33, 84, 67, 0.16);
}

.status-pill,
.module-nav .active,
.mode-chip,
.connection-status {
  border-color: rgba(52, 116, 95, 0.16);
  background: #edf3ee;
  color: var(--brand-dark);
}

.info-grid {
  gap: 12px;
  margin-top: 14px;
}

.next-tags span,
.feature-strip span {
  border-color: rgba(52, 116, 95, 0.18);
  background: #edf3ee;
  color: var(--brand-dark);
}

.toolbox-head,
.community-head {
  border-bottom-color: var(--line);
}

.tool-card:hover,
.community-card:not(.notice-card):hover,
.connection-box:hover {
  transform: none;
}

.shortcut-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(34, 44, 38, 0.25);
}

.shortcut-dialog::backdrop {
  background: rgba(25, 38, 33, 0.44);
  backdrop-filter: blur(5px);
}

.shortcut-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.shortcut-head h2 {
  margin: 4px 0 18px;
  font-size: 25px;
}

.shortcut-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 23px;
  cursor: pointer;
}

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

.shortcut-grid span {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f2;
  font-size: 12px;
}

.shortcut-grid kbd {
  display: grid;
  min-width: 31px;
  height: 31px;
  padding: 0 7px;
  place-items: center;
  border: 1px solid #d4cdbf;
  border-bottom-width: 3px;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  font-family: inherit;
  font-weight: 800;
}

.shortcut-dialog > p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

@keyframes status-pulse {
  50% { opacity: 0.45; transform: scale(0.8); }
}

@keyframes mascot-float {
  50% { transform: translateY(-7px) rotate(1deg); }
}

@keyframes mascot-orbit {
  to { transform: rotate(360deg); }
}

@media (max-width: 960px) {
  .section-head {
    grid-template-columns: 1fr;
  }

  .fish-console {
    min-height: 420px;
  }

  .connection-box {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0 18px;
  }

  .lobby-heading,
  .connection-status,
  .room-help {
    grid-column: 1 / -1;
  }

  .stealth-panel {
    grid-row: 2 / span 2;
  }

  .connection-row {
    grid-column: 2;
  }

  .room-actions {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .site-header {
    position: static;
    padding: 8px 8px 0;
  }

  .module-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 54px;
    padding: 7px 9px;
    border-radius: 16px;
    transform: none;
    filter: none;
    backdrop-filter: none;
  }

  .brand-lockup img {
    width: 31px;
    height: 31px;
  }

  .module-current,
  .mode-chip,
  #shortcut-help-btn {
    display: none;
  }

  .module-nav {
    position: fixed;
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 1800;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: 56px;
    width: auto;
    max-width: none;
    padding: 5px;
    border: 1px solid rgba(126, 119, 101, 0.25);
    border-radius: 17px;
    background: rgba(255, 253, 248, 0.94);
    box-shadow: 0 12px 34px rgba(38, 50, 43, 0.2);
    backdrop-filter: blur(18px);
  }

  .module-nav a {
    display: grid;
    min-width: 0;
    padding: 9px 5px;
    place-items: center;
  }

  .stealth-nav {
    margin-left: auto;
  }

  .stealth-nav button {
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: #faf8f2;
  }

  .game-section,
  .toolbox-section,
  .ai-section,
  .community-section {
    width: calc(100% - 16px);
  }

  .section-head {
    min-height: 0;
    margin-top: 8px;
    padding: 7px;
    gap: 7px;
    border-radius: 20px;
  }

  .fish-console {
    min-height: 390px;
    padding: 24px 18px 18px;
    border-radius: 15px;
  }

  .hero-badge {
    margin-bottom: 24px;
  }

  .fish-console .section-kicker {
    font-size: 8px;
  }

  .fish-console h1 {
    font-size: clamp(38px, 13vw, 52px);
  }

  .hero-visual {
    top: 10px;
    right: 10px;
    width: 92px;
    opacity: 0.58;
  }

  .crayon-sun {
    top: 22px;
    left: auto;
    right: 118px;
    transform: scale(0.68) rotate(-8deg);
  }

  .crayon-star-one,
  .crayon-stroke-blue,
  .crayon-loop {
    display: none;
  }

  .crayon-stroke-red {
    right: 8px;
    bottom: 12px;
    opacity: 0.35;
  }

  .hero-visual-note {
    display: none;
  }

  .fish-console h1,
  .fish-console .section-copy {
    max-width: 100%;
  }

  .defense-team {
    max-width: 100%;
    margin-bottom: 18px;
  }

  .defense-team small {
    display: none;
  }

  .fish-console .section-copy {
    margin: 14px 0 24px;
    font-size: 13px;
  }

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

  .fish-actions button,
  .fish-actions button:nth-child(n) {
    min-height: 90px;
  }

  .connection-box {
    display: block;
    padding: 16px;
    border-radius: 15px;
  }

  .lobby-heading {
    margin-bottom: 14px;
  }

  .stealth-panel {
    display: none;
  }

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

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

  .room-actions button,
  .bot-toggle {
    min-height: 39px;
  }

  .bot-toggle {
    grid-column: span 2;
  }

  .game-overview,
  .info-grid {
    display: none;
  }

  .game-shell {
    margin-top: 8px;
    border-radius: 18px;
  }

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

/* 游戏室统一视觉：不同玩法保留各自材质，但共用清晰的座位与操作层级。 */
#panel-gomoku .wood {
  display: grid;
  padding: clamp(14px, 3vw, 28px);
  place-items: center;
  border: 0;
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(145deg, #5e3822, #3d2419 72%, #271713);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 0 0 10px rgba(21, 10, 6, 0.13), 0 18px 38px rgba(48, 29, 17, 0.2);
}

#panel-gomoku #gomoku-board {
  width: min(100%, 660px);
  border: 1px solid rgba(60, 35, 17, 0.5);
  border-radius: 8px;
  background: #dca557;
  box-shadow: 0 16px 32px rgba(18, 9, 5, 0.34);
}

.gomoku-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--brand-dark);
  font-size: 12px;
}

.gomoku-legend span { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.gomoku-color-choice { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-dark); font-size: 11px; font-weight: 800; white-space: nowrap; }
.gomoku-color-choice select { min-height: 30px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; color: var(--ink); font: inherit; cursor: pointer; }
.gomoku-legend small { margin-left: auto; color: var(--muted); }
.gomoku-legend button { min-width: 64px; min-height: 34px; padding: 6px 12px; border: 1px solid rgba(189,47,36,.34); border-radius: 9px; background: rgba(255,244,241,.9); color: var(--danger); font-size: 12px; font-weight: 900; cursor: pointer; }
.gomoku-legend button:hover:not(:disabled) { border-color: var(--danger); background: var(--danger); color: #fff; }
.gomoku-legend button:disabled { cursor: not-allowed; filter: grayscale(.65); opacity: .42; }
.gomoku-legend .stone { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 3px 6px rgba(18, 20, 22, 0.22); }
.gomoku-legend .stone.black { background: radial-gradient(circle at 35% 28%, #59626a, #111416 68%); }
.gomoku-legend .stone.white { border: 1px solid #c9c0ad; background: radial-gradient(circle at 35% 28%, #fff, #e6dfd1 72%); }

#panel-draw .score-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 58px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: #0b2b43;
  color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(7, 28, 49, 0.14);
}

#panel-draw .score-strip strong {
  min-width: 56px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #f2c94c;
  color: #3d2d00;
  box-shadow: none;
}

#panel-draw .score-strip span:last-child { justify-self: end; font-weight: 900; color: #fff; }

#panel-draw .paper {
  position: relative;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(11, 43, 67, 0.12);
  border-radius: 18px;
  background: #e9e4d8;
  box-shadow: 0 16px 34px rgba(28, 40, 36, 0.1);
}

#panel-draw .paper::before,
#panel-draw .paper::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 7px;
  width: 82px;
  height: 18px;
  background: rgba(242, 201, 76, 0.58);
  transform: rotate(-2deg);
  pointer-events: none;
}

#panel-draw .paper::before { left: 12%; }
#panel-draw .paper::after { right: 12%; transform: rotate(2deg); }

#panel-draw #draw-board {
  border: 1px solid rgba(7, 28, 49, 0.1);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(7, 28, 49, 0.1);
}

.draw-canvas-label {
  position: absolute;
  z-index: 3;
  right: 30px;
  bottom: 25px;
  color: rgba(11, 43, 67, 0.16);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
  pointer-events: none;
}

#draw-pick-panel,
#draw-tools,
#draw-guess-box {
  padding: 10px 12px;
  border: 1px solid rgba(11, 43, 67, 0.12);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 8px 18px rgba(7, 28, 49, 0.06);
}

#draw-pick-panel .choice { border-color: rgba(11, 43, 67, 0.16); border-radius: 9px; background: #f5f1e8; }
#draw-pick-panel .choice:hover { border-color: #ed5548; background: #fff; color: #b6312b; transform: translateY(-2px); }

#draw-tools input[type="color"] { border: 0; border-radius: 50%; overflow: hidden; }
#draw-tools button { border-radius: 9px; }
#draw-guess-box input { min-height: 42px; border-radius: 9px; }

#panel-uno {
  --uno-red: #e4483f;
  --uno-yellow: #f0bd2e;
  --uno-green: #15967e;
  --uno-blue: #347fc4;
}

#panel-uno .uno-table {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 520px;
  padding: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background:
    radial-gradient(circle at 8% 8%, rgba(228, 72, 63, 0.18), transparent 25%),
    radial-gradient(circle at 92% 12%, rgba(52, 127, 196, 0.18), transparent 24%),
    linear-gradient(145deg, #172638, #091522 78%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 20px 44px rgba(7, 27, 42, 0.18);
}

#panel-uno .uno-table::before {
  content: "UNO  ·  KASUKABE GAME NIGHT";
  inset: 14px;
  display: grid;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.045);
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

#panel-uno .uno-players,
#panel-mahjong .mj-players {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#panel-uno .uno-player,
#panel-mahjong .mj-player {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(5, 18, 29, 0.62);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}

#panel-uno .uno-player::before,
#panel-mahjong .mj-player::before { content: none; }

.game-player-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: var(--uno-blue, #64a9d7);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

#panel-uno .seat-2 .game-player-avatar { background: var(--uno-red); }
#panel-uno .seat-3 .game-player-avatar { background: var(--uno-yellow); color: #3d2d00; }
#panel-uno .seat-4 .game-player-avatar { background: var(--uno-green); }

.game-player-name { min-width: 0; }
.game-player-name strong { margin: 0; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.game-player-name em { margin: 3px 0 0; padding: 1px 5px; background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.8); font-size: 9px; }
.game-player-count { display: grid; justify-items: center; color: rgba(255, 255, 255, 0.5); }
.game-player-count b { color: #fff; font-size: 18px; line-height: 1; }
.game-player-count small { margin-top: 3px; font-size: 8px; }

#panel-uno .uno-turn-tag,
#panel-mahjong .mj-turn-tag {
  position: absolute;
  right: 8px;
  bottom: -8px;
  margin: 0;
  padding: 3px 7px;
  border-radius: 99px;
  background: #f2c94c;
  color: #3d2d00;
  font-size: 9px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

#panel-uno .uno-player.active,
#panel-mahjong .mj-player.active { border-color: #f2c94c; box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.14); }

#panel-uno .uno-center {
  grid-template-columns: minmax(160px, 1fr) auto;
  min-height: 150px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  color: #fff;
  box-shadow: none;
}

#panel-uno .uno-center .muted { color: rgba(255, 255, 255, 0.5); }
#panel-uno .uno-card { border-radius: 12px; box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3); }
#panel-uno .uno-color-chip { border: 2px solid rgba(255, 255, 255, 0.7); box-shadow: 0 7px 16px rgba(0, 0, 0, 0.22); }

#panel-uno .uno-info { color: #fff; }
#panel-uno .uno-info div { border-color: rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.06); }
#panel-uno .uno-info strong { color: rgba(255, 255, 255, 0.45); }
#panel-uno .uno-actions { border-radius: 12px; background: rgba(255, 255, 255, 0.055); color: rgba(255, 255, 255, 0.62); }
#panel-uno .uno-actions button { border-radius: 9px; background: var(--uno-red); box-shadow: none; }

#panel-uno .uno-hand {
  min-height: 132px;
  padding: 22px 18px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(1, 10, 18, 0.46);
}

#panel-uno .uno-hand .uno-card { margin-right: -14px; transform: none; }
#panel-uno .uno-hand .uno-card[data-playable] { outline-color: #f2c94c; animation: none; }
#panel-uno .uno-hand .uno-card[data-playable]:hover { transform: translateY(-14px); }

#panel-mahjong .mahjong-table {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 520px;
  padding: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 34%, rgba(71, 145, 126, 0.35), transparent 42%), linear-gradient(145deg, #124d42, #082d29 78%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 20px 44px rgba(7, 27, 42, 0.18);
}

#panel-mahjong .mahjong-table::before {
  content: "春日部雀庄";
  inset: 14px;
  display: grid;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.045);
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 900;
  letter-spacing: 0.18em;
}

#panel-mahjong .mj-player { background: rgba(3, 31, 28, 0.7); }
#panel-mahjong .game-player-avatar { background: #e8e0cc; color: #16463c; }
#panel-mahjong .seat-2 .game-player-avatar { background: #64a9d7; color: #fff; }
#panel-mahjong .seat-3 .game-player-avatar { background: #f2c94c; color: #3d2d00; }
#panel-mahjong .seat-4 .game-player-avatar { background: #ed5548; color: #fff; }

#panel-mahjong .mj-center {
  grid-template-columns: 130px minmax(170px, 1fr);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: rgba(2, 28, 25, 0.45);
  color: #fff;
  box-shadow: none;
}

#panel-mahjong .mj-center .muted { color: rgba(255, 255, 255, 0.5); }
#panel-mahjong .mj-center-river { padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
#panel-mahjong .mj-center-river .mj-river { min-height: 82px; }
#panel-mahjong .mj-river,
#panel-mahjong .mj-melds,
#panel-mahjong .mj-hand { border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(1, 19, 17, 0.38); }

#panel-mahjong .mj-actions { border-radius: 12px; background: rgba(255, 255, 255, 0.055); }
#panel-mahjong .mj-actions button { border-radius: 9px; background: #f2c94c; color: #3d2d00; box-shadow: none; }

#panel-mahjong .mj-tile {
  width: 40px;
  height: 56px;
  border: 1px solid rgba(30, 47, 37, 0.22);
  border-radius: 6px;
  background: linear-gradient(180deg, #fffef9, #eee7d7 76%, #d7ccb5);
  color: #10493e;
  box-shadow: inset 0 -4px 0 rgba(71, 91, 69, 0.12), 0 7px 11px rgba(0, 0, 0, 0.22);
}

#panel-mahjong .mj-hand { min-height: 84px; align-items: end; padding: 10px 12px; flex-wrap: nowrap; overflow-x: auto; }
#panel-mahjong .mj-hand .mj-tile { flex: 0 0 auto; margin-right: -2px; }

@media (max-width: 760px) {
  .gomoku-legend { flex-wrap: wrap; gap: 8px 14px; }
  .gomoku-legend small { flex: 1 1 180px; width: auto; margin-left: 0; }
  .gomoku-legend button { margin-left: auto; }
  #panel-draw .paper { padding: 10px; }
  #panel-draw .paper::before,
  #panel-draw .paper::after { width: 52px; height: 13px; }
  #panel-uno .uno-table,
  #panel-mahjong .mahjong-table { min-height: 500px; padding: 12px; border-radius: 18px; }
  #panel-uno .uno-players,
  #panel-mahjong .mj-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #panel-uno .uno-player,
  #panel-mahjong .mj-player { min-height: 58px; grid-template-columns: 34px minmax(0, 1fr) auto; padding: 7px; }
  .game-player-avatar { width: 34px; height: 34px; }
  #panel-uno .uno-center { min-height: 126px; }
  #panel-uno .uno-info { grid-template-columns: 1fr 1fr 1fr; }
  #panel-uno .uno-hand { min-height: 108px; padding-top: 16px; }
  #panel-uno .uno-hand .uno-card { margin-right: -18px; }
  #panel-mahjong .mj-center { grid-template-columns: 90px minmax(120px, 1fr); }
  #panel-mahjong .mj-tile { width: 34px; height: 48px; font-size: 12px; }
}

@media (max-width: 430px) {
  #panel-draw .score-strip { grid-template-columns: 1fr auto; }
  #panel-draw .score-strip strong { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  #draw-pick-panel { align-items: stretch; }
  #draw-pick-panel > span { width: 100%; }
  #draw-pick-panel .choice { flex: 1 1 30%; padding-inline: 6px; }
  #panel-uno .uno-player,
  #panel-mahjong .mj-player { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px; }
  .game-player-avatar { width: 30px; height: 30px; font-size: 11px; }
  .game-player-name strong { font-size: 11px; }
  .game-player-count b { font-size: 15px; }
  #panel-uno .uno-info strong { font-size: 9px; }
  #panel-uno .uno-info span { font-size: 11px; }
  #panel-mahjong .mj-center { grid-template-columns: 72px minmax(100px, 1fr); padding: 9px; }
}

/* 房间连续战绩：只在记分牌使用一个专属徽记，不把图标铺满所有功能。 */
.series-scoreboard {
  --series-accent: #d99d45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  margin: 0 0 10px;
  padding: 9px 11px;
  overflow: hidden;
  border: 1px solid rgba(31, 76, 63, 0.12);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 8px 20px rgba(30, 49, 41, 0.06);
}

.series-scoreboard:empty { display: none; }
#panel-gomoku .series-scoreboard { --series-accent: #9b6235; }
#panel-draw .series-scoreboard { --series-accent: #347fc4; }
#panel-doudizhu .series-scoreboard { --series-accent: #eb5548; }
#panel-uno .series-scoreboard { --series-accent: #15967e; }
#panel-mahjong .series-scoreboard { --series-accent: #187562; }

.series-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.series-heading > span:last-child { display: grid; gap: 2px; }
.series-heading strong { color: var(--brand-dark); font-size: 13px; }
.series-heading small { color: var(--muted); font-size: 9px; }

.series-emblem {
  position: relative;
  display: grid;
  width: 38px;
  height: 42px;
  place-items: center;
  clip-path: polygon(50% 0, 91% 18%, 84% 72%, 50% 100%, 16% 72%, 9% 18%);
  background: var(--series-accent);
  filter: drop-shadow(0 5px 7px rgba(20, 36, 31, 0.14));
}

.series-emblem::before {
  content: "KB";
  display: grid;
  width: 26px;
  height: 29px;
  place-items: center;
  clip-path: inherit;
  background: #fffdf7;
  color: var(--series-accent);
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: -0.04em;
}

.series-emblem i {
  position: absolute;
  right: 4px;
  bottom: 7px;
  width: 6px;
  height: 6px;
  border: 2px solid #fffdf7;
  border-radius: 50%;
  background: var(--series-accent);
}

.series-scores {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.series-player {
  position: relative;
  display: grid;
  grid-template-columns: minmax(58px, auto) auto;
  align-items: center;
  gap: 8px;
  min-width: 100px;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid rgba(31, 76, 63, 0.1);
  border-radius: 10px;
  background: #f5f1e8;
}

.series-player small {
  overflow: hidden;
  color: #66736d;
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-player b {
  color: var(--brand-dark);
  font-size: 19px;
  line-height: 1;
  text-align: right;
}

.series-player.is-me {
  border-color: color-mix(in srgb, var(--series-accent) 40%, transparent);
  background: color-mix(in srgb, var(--series-accent) 8%, #fffdf8);
}

.series-player.is-leader b { color: var(--series-accent); }

.series-player > i {
  position: absolute;
  top: -1px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 0 0 5px 5px;
  background: var(--series-accent);
  color: #fff;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}

@media (max-width: 600px) {
  .series-scoreboard { align-items: stretch; flex-direction: column; gap: 8px; padding: 9px; }
  .series-emblem { width: 32px; height: 35px; }
  .series-emblem::before { width: 22px; height: 24px; font-size: 7px; }
  .series-heading { width: 100%; }
  .series-scores { width: 100%; padding-bottom: 2px; }
  .series-player { flex: 1 0 92px; min-width: 92px; }
}

/* 斗地主结束提示保留在牌桌内；统一的下一局入口由游戏面板提供。 */
#panel-doudizhu .ddz-result {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  text-align: left;
}

#panel-doudizhu .ddz-result-copy {
  display: grid;
  gap: 4px;
}

#panel-doudizhu .ddz-result-copy > span {
  font-size: 12px;
  font-weight: 800;
}

#panel-doudizhu .hand.round-over {
  opacity: 0.58;
  pointer-events: none;
  filter: saturate(0.55);
}

@media (max-width: 520px) {
  #panel-doudizhu .ddz-result { grid-template-columns: 1fr; text-align: center; }
  #panel-doudizhu .ddz-result button { width: 100%; }
}

/* 下班倒计时：保持在右上角，默认足够小，也能折叠成边缘标签。 */
.offwork-widget {
  position: fixed;
  z-index: 1750;
  top: 78px;
  right: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  width: 176px;
  min-height: 54px;
  overflow: hidden;
  border: 1px solid rgba(45, 94, 78, 0.2);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 12px 30px rgba(28, 48, 39, 0.14);
  backdrop-filter: blur(14px);
}

.offwork-widget-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 5px 8px 10px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  text-align: left;
  cursor: pointer;
}

.offwork-widget-main > span:last-child { display: grid; min-width: 0; gap: 1px; }
.offwork-widget-main small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.offwork-widget-main strong { font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; line-height: 1.1; }

.offwork-dot {
  position: relative;
  flex: 0 0 auto;
  width: 25px;
  height: 29px;
  border: 2px solid rgba(120, 72, 31, 0.68);
  border-radius: 47% 53% 45% 55% / 55% 48% 52% 45%;
  background: linear-gradient(145deg, #f1c26e, #d6903e);
  transform: rotate(7deg);
  box-shadow: inset -3px -4px 0 rgba(133, 73, 29, 0.1);
}

.offwork-dot::before,
.offwork-dot::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(139, 77, 34, 0.55);
}

.offwork-dot::before { top: 7px; left: 6px; }
.offwork-dot::after { right: 5px; bottom: 6px; }

.offwork-hide {
  width: 26px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(45, 94, 78, 0.1);
  background: rgba(45, 94, 78, 0.04);
  color: #809087;
  font-size: 16px;
  cursor: pointer;
}

.offwork-widget.is-finished {
  border-color: rgba(232, 173, 83, 0.65);
  background: #fff5cf;
  animation: offwork-finish-pulse 1.8s ease-in-out infinite;
}

.offwork-widget.is-finished .offwork-widget-main strong { color: #a45b18; }

.offwork-restore {
  position: fixed;
  z-index: 1750;
  top: 92px;
  right: 0;
  min-width: 0;
  padding: 7px 5px 7px 7px;
  border: 1px solid rgba(45, 94, 78, 0.18);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--brand-dark);
  box-shadow: 0 8px 20px rgba(28, 48, 39, 0.12);
  font-size: 9px;
  font-weight: 900;
  cursor: pointer;
  writing-mode: vertical-rl;
}

.offwork-modal {
  position: fixed;
  z-index: 3200;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
  background: rgba(19, 39, 32, 0.48);
  backdrop-filter: blur(7px);
}

.offwork-modal-card {
  width: min(430px, 100%);
  padding: 25px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: #fffdf8;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(17, 38, 30, 0.28);
}

.offwork-modal-kicker {
  color: #c47b2c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.offwork-modal-card h2 { margin: 7px 0 8px; color: var(--brand-dark); font-size: 27px; }
.offwork-modal-card > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.offwork-time-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f1e8;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.offwork-time-field input {
  width: 126px;
  min-height: 42px;
  border: 1px solid rgba(45, 94, 78, 0.18);
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  font: 900 18px/1 inherit;
  text-align: center;
}

.offwork-notify-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.offwork-notify-option input { width: 16px; height: 16px; accent-color: var(--brand); }

.offwork-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 9px;
  margin-top: 20px;
}

.offwork-modal-actions.single { grid-template-columns: 1fr; }
.offwork-modal-actions button { min-height: 43px; border-radius: 11px; }
.offwork-modal-actions button.primary { border-color: var(--brand); background: var(--brand); color: #fff; }

.offwork-alert .offwork-modal-card { text-align: center; }

.offwork-finish-mark {
  display: grid;
  width: 62px;
  height: 67px;
  margin: 0 auto 14px;
  place-items: center;
  border: 3px solid #8f5728;
  border-radius: 46% 54% 44% 56% / 54% 48% 52% 46%;
  background: linear-gradient(145deg, #f3c772, #d99443);
  color: #65401f;
  font-size: 15px;
  font-weight: 1000;
  transform: rotate(-4deg);
  box-shadow: 0 12px 22px rgba(104, 61, 28, 0.18);
}

@keyframes offwork-finish-pulse {
  50% { box-shadow: 0 12px 32px rgba(214, 144, 62, 0.3); transform: translateY(-2px); }
}

body.stealth-mode .offwork-widget,
body.stealth-mode .offwork-restore {
  border-color: #d6dde1;
  background: rgba(246, 248, 249, 0.96);
  color: #59636d;
  box-shadow: 0 8px 20px rgba(45, 54, 62, 0.1);
}

body.stealth-mode .offwork-dot { border-color: #8c969c; background: #d8dee2; filter: grayscale(1); }
body.popout-page .offwork-widget,
body.popout-page .offwork-restore,
body.reader-popout-page .offwork-widget,
body.reader-popout-page .offwork-restore { display: none !important; }

@media (max-width: 720px) {
  .offwork-widget { top: 102px; right: 8px; width: 150px; min-height: 50px; }
  .offwork-widget-main { gap: 7px; padding-left: 8px; }
  .offwork-widget-main strong { font-size: 14px; }
  .offwork-dot { width: 22px; height: 25px; }
  .offwork-restore { top: 110px; }
  .offwork-modal-card { padding: 21px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .offwork-widget.is-finished { animation: none; }
}

@media (max-width: 390px) {
  .module-brand {
    font-size: 13px;
  }

  .stealth-nav button {
    padding-inline: 8px;
    font-size: 10px;
  }

  .fish-console {
    min-height: 370px;
  }

  .fish-actions button,
  .fish-actions button:nth-child(n) {
    min-height: 82px;
    padding: 12px;
  }

  .fish-actions i {
    margin-bottom: 8px;
  }
}

/* Popouts retain their purpose-built compact layouts. */
body.popout-page,
body.reader-popout-page {
  padding-bottom: 0;
}

body.popout-page .section-head,
body.popout-page .game-overview,
body.popout-page .info-grid,
body.popout-page .module-nav {
  display: none !important;
}

body.stealth-mode .fish-console {
  background: #eef0eb;
  color: #303832;
}

body.stealth-mode .crayon-doodles {
  opacity: 0.14;
  filter: grayscale(1);
}

body.stealth-mode .fish-console h1,
body.stealth-mode .fish-console .section-copy,
body.stealth-mode .fish-console .section-kicker,
body.stealth-mode .fish-actions button,
body.stealth-mode .fish-actions span {
  color: #465049;
}

body.stealth-mode .defense-team {
  border-color: rgba(52, 116, 95, 0.18);
  background: rgba(255, 253, 248, 0.7);
}

body.stealth-mode .defense-team strong {
  color: var(--brand-dark);
}

body.stealth-mode .defense-team small {
  color: #68756d;
}

body.stealth-mode .fish-console .section-kicker b {
  border-color: rgba(52, 116, 95, 0.3);
  color: #92601f;
}

body.stealth-mode .hero-badge {
  border-color: rgba(52, 116, 95, 0.2);
  background: rgba(226, 235, 228, 0.88);
  color: var(--brand-dark);
}

body.stealth-mode .hero-badge strong,
body.stealth-mode .fish-actions strong {
  color: var(--brand-dark);
}

body.stealth-mode .fish-actions button,
body.stealth-mode .fish-actions button:nth-child(n) {
  border-color: rgba(52, 116, 95, 0.22);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 6px 18px rgba(45, 63, 53, 0.08);
}

body.stealth-mode .fish-actions button:hover {
  border-color: rgba(52, 116, 95, 0.42);
  background: #fffdf8;
}

body.stealth-mode .fish-actions span {
  color: #59675f;
}

body.stealth-mode .fish-actions i {
  background: #f5ead4;
  color: #92601f;
}
