/* ------------------------------------------------------------------ *
 * Minimal LinkedIn-games shell around the Unity WebGL canvas.
 * Matches LinkedIn's daily puzzles (Wend / Patches / Zip): plain dark
 * page, a slim header (back arrow + title left, Reset / help right) and
 * the game centred below. No cards, gradients or decoration.
 * The Unity build itself is unchanged.
 * ------------------------------------------------------------------ */

:root {
  --li-bg: #000000;
  --li-text: #ffffff;
  --li-muted: #b0b0b0;
  --li-line: rgba(255, 255, 255, 0.18);
  --li-line-soft: rgba(255, 255, 255, 0.10);
  --li-game-bg: #1a1a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--li-bg);
  color: var(--li-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
}

/* ---- Slim game header ---------------------------------------------- */
.li-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}
.li-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.li-back {
  flex: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--li-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.li-back:hover { background: rgba(255, 255, 255, 0.08); }
.li-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.li-reset {
  padding: 7px 16px;
  border: 1px solid var(--li-line);
  border-radius: 18px;
  background: transparent;
  color: var(--li-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.li-reset:hover { background: rgba(255, 255, 255, 0.08); }
.li-help-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--li-line);
  background: transparent;
  color: var(--li-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.li-help-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* Settings dropdown */
.li-settings { position: relative; }
.li-settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--li-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.li-settings-btn:hover { background: rgba(255, 255, 255, 0.08); }
.li-caret { font-size: 11px; }
.li-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 170px;
  padding: 6px;
  background: #1f1f1f;
  border: 1px solid var(--li-line-soft);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.li-menu[hidden] { display: none; }
.li-menu-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--li-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.li-menu-item:hover { background: rgba(255, 255, 255, 0.10); }

/* ---- Game area ----------------------------------------------------- */
.li-main {
  display: flex;
  justify-content: center;
  padding: 8px 16px 24px;
}
#unity-container.unity-desktop {
  position: relative;
  flex: none;
  /* Size off the available height so the portrait board always fits
     vertically, but never wider than the viewport. Keeps an exact 9:16. */
  width: min(calc((100vh - 110px) * 9 / 16), 100%);
  aspect-ratio: 9 / 16;
  background: var(--li-game-bg);
  border: 1px solid var(--li-line-soft);
  border-radius: 12px;
  overflow: hidden;
}
.unity-desktop #unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--li-game-bg);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- How-to-play modal --------------------------------------------- */
.li-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.li-modal[hidden] { display: none; }
.li-modal-box {
  width: 100%;
  max-width: 400px;
  background: #1f1f1f;
  border: 1px solid var(--li-line-soft);
  border-radius: 12px;
  padding: 22px 22px 18px;
}
.li-modal-box h2 { margin: 0 0 6px; font-size: 19px; }
.li-modal-box p { margin: 0 0 14px; font-size: 14px; color: var(--li-muted); }
.li-modal-box ul { margin: 0 0 18px; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--li-text); }
.li-modal-close {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 20px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ---- Unity loading bar / warning (kept from default template) ------- */
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center; }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center; }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center; }
#unity-footer { display: none; }
#unity-warning { position: absolute; left: 50%; top: 8%; transform: translate(-50%); background: #1f1f1f; color: #fff; padding: 10px; border-radius: 6px; display: none; }
