/* Gamification Task Tracker (GTT) - minimalist UI */
.gtt-root {
  box-sizing: border-box;
  --gtt-bg: #ffffff;
  --gtt-fg: #0f0f10;
  --gtt-muted: rgba(15, 15, 16, 0.55);
  --gtt-border: rgba(15, 15, 16, 0.9);
  --gtt-border-soft: rgba(15, 15, 16, 0.25);
  --gtt-card: rgba(15, 15, 16, 0.02);
  --gtt-shadow: 0 14px 60px rgba(0,0,0,0.08);
  /* Subtle curves (avoid pill-y UI) */
  --gtt-radius: 10px;

  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--gtt-fg);
  background: var(--gtt-bg);
}

.gtt-root * { box-sizing: border-box; }

/*
  Inline SVG icons
  - We inject SVG markup inline (fetch + innerHTML).
  - Many designer-exported SVGs include huge width/height (e.g., 1000x1000).
  - Force SVGs to scale to their container so they don't blow up layouts,
    especially in mobile icon grids and small button icons.
*/
.gtt-root [data-gtt-icon] svg{
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.gtt-app {
  max-width: 1180px;
  margin: 24px auto;
  padding: 14px 14px 20px;
}

.gtt-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  padding: 6px 4px 14px;
}

.gtt-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.gtt-title h1 {
  margin: 0;
  font-size: 54px;
  letter-spacing: -0.04em;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 0.9;
}

.gtt-mark {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  transform: translateY(-3px);
}
.gtt-brand-icon{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gtt-fg);
  /* Constrain brand mark size (designer SVGs often have huge intrinsic sizes). */
  width: 76px;
  height: 34px;
}
.gtt-brand-icon svg{
  width: 100%;
  height: 100%;
  display: block;
}
.gtt-mark .sq {
  width: 34px; height: 34px;
  background: var(--gtt-fg);
  border-radius: 6px;
}
.gtt-mark .ci {
  width: 34px; height: 34px;
  background: var(--gtt-fg);
  border-radius: 999px;
}

.gtt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mobile page tabs (Consistency / Clarity) */
.gtt-viewtabs{ display:none; gap:10px; align-items:center; }
.gtt-viewtab{
  border:2px solid #111;
  background:#fff;
  color:#111;
  border-radius:12px;
  padding:8px 12px;
  font-weight:1000;
  letter-spacing:0.2px;
  cursor:pointer;
  line-height:1;
}
.gtt-viewtab.active{ background:#111; color:#fff; }
.gtt-viewtab:active{ transform: translateY(1px); }

.gtt-btn-ic{ display:inline-grid; width:18px; height:18px; }

.gtt-btn {
  appearance: none;
  border: 2px solid var(--gtt-border);
  background: var(--gtt-fg);
  color: var(--gtt-bg);
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
  box-shadow: 0 10px 26px rgba(0,0,0,0.12);
}
.gtt-btn:active { transform: translateY(1px) scale(0.99); }
.gtt-btn.secondary {
  background: transparent;
  color: var(--gtt-fg);
  box-shadow: none;
}
.gtt-btn.danger{
  background: transparent;
  color: #B00020;
  border-color: rgba(176,0,32,0.9);
  box-shadow: none;
}
.gtt-btn.danger:hover{ background: rgba(176,0,32,0.06); }
.gtt-btn.icon {
  padding: 10px 12px;
  width: 44px;
  justify-content: center;
}

.gtt-link-ic {
  width: 18px;
  height: 18px;
  display: inline-block;
  position: relative;
}
.gtt-link-ic:before,
.gtt-link-ic:after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(0deg);
}
.gtt-link-ic:after {
  transform: translate(6px, -6px);
  opacity: 0.9;
}

.gtt-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
}

.gtt-leftcol {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gtt-panel {
  border: 3px solid var(--gtt-border);
  border-radius: var(--gtt-radius);
  background: #fff;
  overflow: hidden;
}

.gtt-panel.dashed {
  border-style: dashed;
}

.gtt-panel .hd {
  padding: 12px 14px 10px;
  border-bottom: 2px solid var(--gtt-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gtt-hd-actions{ display:flex; align-items:center; gap: 10px; }

.gtt-hd-iconbtn{
  appearance: none;
  border: 2px solid var(--gtt-border);
  background: #fff;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 140ms ease, background 160ms ease, box-shadow 160ms ease;
}
.gtt-hd-iconbtn:hover{ background: rgba(0,0,0,0.03); box-shadow: 0 12px 28px rgba(0,0,0,0.10); transform: translateY(-1px); }
.gtt-hd-iconbtn:active{ transform: translateY(1px); }
.gtt-hd-iconbtn .ic{ width: 18px; height: 18px; display: grid; place-items:center; }
.gtt-panel .hd h2{
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.gtt-leader {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gtt-leader-item {
  border: 2px solid var(--gtt-border);
  border-radius: 12px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0,0,0,0.01);
  cursor: pointer;
  user-select: none;
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  will-change: transform;
}
.gtt-leader-item:hover {
  background: rgba(0,0,0,0.03);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}
.gtt-leader-item.active { background: rgba(0,0,0,0.06); border-style: solid; }

.gtt-li-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.gtt-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 2px solid rgba(0,0,0,0.12);
}

/* Leaderboard icon (replaces colored dot) */
.gtt-li-ic{
  /* Hard cap size so inline SVGs can never blow up the row (especially on iOS Safari). */
  width: 22px !important;
  height: 22px !important;
  max-width: 22px;
  max-height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.gtt-li-ic svg{ width: 100% !important; height: 100% !important; display:block; }

/* Defensive: if a theme or older markup renders the icon wrapper without .gtt-li-ic,
   still clamp any inline icon slot inside a leaderboard row. */
.gtt-leader-item [data-gtt-icon]{
  width: 22px !important;
  height: 22px !important;
  max-width: 22px;
  max-height: 22px;
  flex: 0 0 22px;
  overflow: hidden;
}
.gtt-li-name{
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gtt-li-score{
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.gtt-li-score span{
  font-weight: 900;
  opacity: 0.55;
  font-size: 12px;
  margin-left: 4px;
  text-transform: uppercase;
}

.gtt-li-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Desktop leaderboard checkbox indicator (for graph filtering) */
.gtt-li-check{
  width: 18px;
  height: 18px;
  border: 2px solid var(--gtt-border);
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.gtt-leader-item.active .gtt-li-check{
  background: #111;
  border-color: #111;
}
.gtt-leader-item.active .gtt-li-check::after{
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  transform: translateY(-1px);
}

/* Checkbox/todos mode: show check for "done today" instead of selection. */
.gtt-leader-item.done .gtt-li-check{
  background: #111;
  border-color: #111;
}
.gtt-leader-item.done .gtt-li-check::after{
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  transform: translateY(-1px);
}

/* Hide leaderboard selection UI on mobile (phone UX stays the same). */
@media (max-width: 980px){
  .gtt-hd-iconbtn[data-action="lbmode"],
  .gtt-li-check{ display:none; }
}

.gtt-history {
  max-height: 330px;
  overflow: auto;
}
.gtt-history-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gtt-h-item{
  border-left: 4px solid rgba(0,0,0,0.12);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.02);
}
.gtt-h-top{
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.gtt-h-text{
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
}
.gtt-h-date{
  font-size: 12px;
  opacity: 0.65;
  white-space: nowrap;
}
.gtt-h-sub{
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.75;
}

.gtt-maincol {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Slight breathing room at the bottom (desktop request). */
  padding-bottom: 14px;
}

.gtt-notice {
  border: 2px solid var(--gtt-border-soft);
  background: rgba(0,0,0,0.02);
  padding: 10px 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Subtle "stored in browser" warning */
.gtt-notice.local {
  border: 2px solid rgba(180,0,0,0.28);
  background: rgba(200,0,0,0.04);
}
.gtt-notice-text{
  min-width: 0;
}
.gtt-notice-pill{
  border: 2px solid var(--gtt-border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.75;
  background: rgba(0,0,0,0.02);
  white-space: nowrap;
}
.gtt-notice-x{
  appearance: none;
  border: 2px solid rgba(180,0,0,0.35);
  background: rgba(255,0,0,0.03);
  color: rgba(160,0,0,0.9);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 140ms ease, background 140ms ease;
}
.gtt-notice-x:active{ transform: translateY(1px); }
.gtt-notice strong {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.gtt-notice span {
  display: block;
  font-size: 13px;
  opacity: 0.75;
  margin-top: 2px;
}

.gtt-graph-panel {
  padding: 10px;
}
.gtt-graph-shell{
  border: 3px solid var(--gtt-border);
  border-radius: var(--gtt-radius);
  padding: 12px;
  position: relative;
  overflow: hidden;
  min-height: 360px;
}
.gtt-graph-toprow{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}
.gtt-tab{
  border: 2px solid var(--gtt-border);
  background: transparent;
  color: var(--gtt-fg);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}
.gtt-tab.active{
  opacity: 1;
  background: rgba(0,0,0,0.06);
}
.gtt-tab:active{ transform: translateY(1px); }

.gtt-graph-svg{
  width: 100%;
  height: 320px;
  display: block;
}
.gtt-axis{
  stroke: rgba(0,0,0,0.75);
  stroke-width: 7;
  stroke-linecap: round;
}
.gtt-axis-muted{
  stroke: rgba(0,0,0,0.12);
  stroke-width: 1;
}
.gtt-line{
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  transition: opacity 160ms ease;
}
.gtt-line.dim{ opacity: 0.0; }

.gtt-pt{
  r: 4.5;
  stroke: rgba(255,255,255,0.9);
  stroke-width: 2;
  opacity: 0.95;
  transition: opacity 160ms ease;
}
.gtt-pt.dim{ opacity: 0.0; }

.gtt-xlabels{
  font-size: 12px;
  font-weight: 800;
  fill: rgba(0,0,0,0.5);
}
.gtt-ylabel{
  font-size: 12px;
  font-weight: 800;
  fill: rgba(0,0,0,0.55);
}

.gtt-streak-badge{
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%) scale(0.98);
  background: rgba(255,255,255,0.96);
  border: 3px solid var(--gtt-border);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--gtt-shadow);
  --gtt-badge-scale: 1;
  --gtt-badge-pop: 1.08;
  --gtt-badge-accent: #111111;
  opacity: 0;
  pointer-events: none;
}

/* Rainbow "trail" behind the badge */
.gtt-badge-trail{
  position: absolute;
  inset: -18px;
  border-radius: 28px;
  background: radial-gradient(circle at center, rgba(0,0,0,0.22), rgba(0,0,0,0) 70%);
  filter: blur(14px);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  z-index: -2;
}

.gtt-streak-badge::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  transform: translateY(14px);
  opacity: 0;
  z-index: -1;
  /* subtle depth layers */
  box-shadow:
    0 8px 0 rgba(0,0,0,0.10),
    0 16px 0 rgba(0,0,0,0.06);
}

.gtt-streak-badge.show{
  animation: gttBadgePop 1400ms cubic-bezier(0.18, 0.82, 0.2, 1) both;
}
.gtt-streak-badge.show .gtt-badge-trail{
  animation: gttTrail 1400ms cubic-bezier(0.18, 0.82, 0.2, 1) both;
}
.gtt-streak-badge.show::after{
  animation: gttStack 1400ms cubic-bezier(0.18, 0.82, 0.2, 1) both;
}

@keyframes gttBadgePop{
  0%{ opacity: 0; transform: translate(-50%, -10%) scale(var(--gtt-badge-scale)); }
  22%{ opacity: 1; transform: translate(-50%, -50%) scale(var(--gtt-badge-pop)); }
  60%{ opacity: 1; transform: translate(-50%, -56%) scale(var(--gtt-badge-scale)); }
  100%{ opacity: 0; transform: translate(-50%, -70%) scale(var(--gtt-badge-scale)); }
}

@keyframes gttTrail{
  0%{ opacity: 0.0; transform: translateY(22px) scale(0.98); }
  25%{ opacity: 0.62; transform: translateY(10px) scale(1.02); }
  65%{ opacity: 0.35; transform: translateY(0px) scale(1.00); }
  100%{ opacity: 0.0; transform: translateY(-10px) scale(0.98); }
}

@keyframes gttStack{
  0%{ opacity: 0.0; transform: translateY(18px); }
  25%{ opacity: 1.0; transform: translateY(12px); }
  60%{ opacity: 0.85; transform: translateY(12px); }
  100%{ opacity: 0.0; transform: translateY(18px); }
}
.gtt-badge-streak{
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.gtt-badge-points{
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.gtt-badge-points .plus{
  color: rgba(0,0,0,0.18);
  margin-right: 8px;
}
.gtt-badge-points .pts{
  opacity: 0.45;
  font-weight: 900;
  font-size: 18px;
  text-transform: uppercase;
  margin-left: 6px;
}

.gtt-bottom {
  margin-top: 14px;
  border-top: 2px solid var(--gtt-border-soft);
  padding-top: 12px;
}

.gtt-controls-row{
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* Desktop bottom section is always an edit surface; this is just a label (not a button). */
.gtt-edit-ind{
  display:flex;
  align-items:center;
  padding: 12px 4px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 16px;
  opacity: 0.85;
  user-select: none;
}

.gtt-ctl{
  appearance: none;
  border: 3px solid var(--gtt-border);
  background: #fff;
  border-radius: 14px;
  /* Prevent theme button/link colors (e.g. iOS Safari blue) from bleeding in. */
  color: var(--gtt-fg);
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  transition: transform 140ms ease, background 160ms ease, opacity 160ms ease;
}
.gtt-ctl:active{ transform: translateY(1px); }
.gtt-ctl.dashed{ border-style: dashed; }
.gtt-ctl.active{ background: rgba(0,0,0,0.06); border-style: solid; }

.gtt-ctl-dot{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--gtt-fg);
  flex: 0 0 auto;
}

.gtt-ctl-pencil{
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
  opacity: 0.9;
}
.gtt-ctl-pencil::before{ content: "✎"; }

.gtt-ctl-label{
  font-size: 16px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.gtt-ctl-ic{
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.gtt-ctl-meta{
  margin-left: auto;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.65;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

@media (max-width: 760px){
  .gtt-controls-row{ flex-direction: column; }
  .gtt-ctl{ width: 100%; justify-content: space-between; }
}

/* Mobile-only sections (icon checkoffs + edit tabs) */
.gtt-mobile-todos, .gtt-mobile-edit{ display:none; }

.gtt-mobile-todos-grid{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 6px 0 14px;
}

.gtt-mtodo{
  appearance:none;
  border: 2px solid #111;
  background: #fff;
  border-radius: 14px;
  /* Prevent theme button colors from tinting icons/text on mobile. */
  color: var(--gtt-fg);
  height: 64px;
  cursor: pointer;
  display:grid;
  place-items:center;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.gtt-mtodo .gtt-mtodo-ic{ width: 28px; height: 28px; display:grid; color: var(--hc, #111); }
.gtt-mtodo:hover{ transform: translateY(-2px); box-shadow: 0 16px 36px rgba(0,0,0,0.10); }
.gtt-mtodo.done{ background: var(--hc, #111); }
.gtt-mtodo.done .gtt-mtodo-ic{ color: #fff; }

.gtt-mobile-edit-tabs{
  display:flex;
  gap: 10px;
  overflow:auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}

.gtt-mobile-edit-hd{
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 14px;
  margin: 2px 2px 6px;
}

.gtt-medit{
  appearance:none;
  border: 2px solid #111;
  background: #fff;
  border-radius: 14px;
  /* Prevent theme button colors from tinting this pill on mobile. */
  color: var(--gtt-fg);
  padding: 10px 12px;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 900;
  white-space: nowrap;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.gtt-medit .ic{ width: 22px; height: 22px; display:grid; }
.gtt-medit .nm{ font-size: 12px; letter-spacing: -0.01em; text-transform: uppercase; }
.gtt-medit:hover{ transform: translateY(-2px); box-shadow: 0 16px 36px rgba(0,0,0,0.10); background: rgba(0,0,0,0.02); }

/* Do not round mobile tab SVGs (requested). */
.gtt-medit .ic,
.gtt-medit .ic svg,
.gtt-mtodo-ic,
.gtt-mtodo-ic svg{
  border-radius: 0 !important;
}
.gtt-habits{
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}
.gtt-habit{
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,0.01);
  cursor: pointer;
  user-select: none;
  transition: transform 150ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  will-change: transform;
}
.gtt-habit:hover{
  background: rgba(0,0,0,0.03);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.08);
}
.gtt-habit:active{ transform: translateY(1px); }

.gtt-habit-left{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.gtt-habit-ic{
  width: 54px;
  height: 54px;
  /* Desktop icon containers should be squared-off (no rounding). */
  border-radius: 0;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  flex: 0 0 auto;
  overflow: hidden;
}
.gtt-habit-ic svg{
  width: 46px;
  height: 46px;
  display: block;
}
.gtt-habit-name{
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gtt-habit-desc{
  font-size: 12px;
  opacity: 0.62;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gtt-habit-right{
  text-align: right;
}
.gtt-habit-meta{
  font-size: 12px;
  opacity: 0.7;
  font-weight: 900;
}
.gtt-habit-meta strong{
  opacity: 1;
}

.gtt-sidecontrols{
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  min-width: 210px;
}
.gtt-stat{
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.01);
}
.gtt-stat .k{
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
  opacity: 0.6;
  letter-spacing: 0.08em;
}
.gtt-stat .v{
  margin-top: 4px;
  font-size: 18px;
  font-weight: 900;
}
.gtt-chill-row{
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.gtt-chill-left{
  display: flex;
  flex-direction: column;
}
.gtt-chill-left .v{ font-size: 18px; }
.gtt-chill-left .sub{
  font-size: 12px;
  opacity: 0.65;
  font-weight: 700;
  margin-top: 2px;
}

.gtt-toast{
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(15,15,16,0.96);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  box-shadow: 0 18px 60px rgba(0,0,0,0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 99999;
}
.gtt-toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

.gtt-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 99998;
}
.gtt-modal.show{ display: flex; }

.gtt-modal-card{
  width: min(780px, 96vw);
  background: #fff;
  border-radius: 16px;
  border: 3px solid var(--gtt-border);
  box-shadow: var(--gtt-shadow);
  overflow: hidden;
  /* Ensure modals fit on small screens; scroll content inside. */
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

/* Make the modal body (2nd child) the scroll container so headers/footers stay visible. */
.gtt-modal-card > :nth-child(2){
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.gtt-modal-hd{
  padding: 12px 14px;
  border-bottom: 2px solid var(--gtt-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.gtt-modal-hd h3{
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}
.gtt-modal-bd{
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.gtt-field label{
  display: block;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.65;
  margin-bottom: 6px;
}
.gtt-field input[type="text"],
.gtt-field textarea,
.gtt-field input[type="number"]{
  width: 100%;
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 10px 10px;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}
.gtt-field textarea{
  min-height: 92px;
  resize: vertical;
}
.gtt-field .row{
  display: flex;
  gap: 10px;
  align-items: center;
}
.gtt-field input[type="color"]{
  width: 48px;
  height: 44px;
  border: 2px solid var(--gtt-border);
  border-radius: 12px;
  padding: 0;
  background: transparent;
}

.gtt-icons {
  border: 2px solid var(--gtt-border-soft);
  border-radius: 16px;
  padding: 10px;
  max-height: 250px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.gtt-icbtn{
  border: 2px solid var(--gtt-border);
  border-radius: 12px;
  background: rgba(0,0,0,0.01);
  padding: 10px 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 140ms ease, background 160ms ease, opacity 160ms ease;
}
.gtt-icbtn:hover { background: rgba(0,0,0,0.04); }
.gtt-icbtn:active { transform: translateY(1px); }
.gtt-icbtn.active { background: rgba(0,0,0,0.06); border-style: solid; }
.gtt-icbtn img, .gtt-icbtn svg{
  width: 26px;
  height: 26px;
  display: block;
}
.gtt-modal-ft{
  padding: 12px 14px;
  border-top: 2px solid var(--gtt-border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Chill confirm modal */
.gtt-confirm .gtt-modal-card{
  width: min(560px, 96vw);
}
.gtt-confirm-bd{
  display: block;
}
.gtt-confirm-lead{
  font-weight: 900;
  font-size: 14px;
  line-height: 1.35;
}
.gtt-confirm-meta{
  margin-top: 10px;
  font-weight: 900;
  font-size: 13px;
  opacity: 0.75;
}

@media (max-width: 980px){
  /* Give the whole UI breathing room on small screens */
  .gtt-root{ padding: 8px; }

  /* Mobile layout order: graph, habits, history, leaderboard */
  .gtt-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .gtt-maincol{ order: 1; }
  .gtt-leftcol{ order: 2; }
  .gtt-panel-history{ order: 1; }
  .gtt-panel-leader{ order: 2; }

  /* Show page tabs */
  .gtt-viewtabs{ display:flex; }

  /* Mobile: icon checkoffs + edit tabs (hide big list + edit-mode toggle) */
  .gtt-habits{ display:none; }
  .gtt-mobile-todos, .gtt-mobile-edit{ display:block; }
  .gtt-controls-row button[data-action="edit"]{ display:none; }
  .gtt-edit-ind{ display:none; }

  /* Mobile page switch */
  .gtt-root[data-gtt-view="clarity"] .gtt-graph-panel,
  .gtt-root[data-gtt-view="clarity"] .gtt-bottom,
  .gtt-root[data-gtt-view="clarity"] .gtt-leftcol{ display:none; }
  .gtt-root[data-gtt-view="consistency"] .gtt-clarity-panel{ display:none; }

  .gtt-habits { grid-template-columns: 1fr; }
  .gtt-sidecontrols { min-width: 0; }
  .gtt-modal-bd{ grid-template-columns: 1fr; }
}

@media (max-width: 760px){
  .gtt-topbar{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .gtt-actions{
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .gtt-btn{
    flex: 1 1 auto;
    justify-content: center;
  }
  .gtt-title h1{ font-size: 44px; }
}

@media (max-width: 520px){
  .gtt-actions{ flex-direction: column; align-items: stretch; }
  .gtt-btn{ width: 100%; }
  .gtt-title h1{ font-size: 38px; }
  /* Mobile graph: give the chart more room and reduce dead space. */
  .gtt-graph-shell{ min-height: 0; }
  /*
    The SVG was previously fixed-height, but because the viewBox is very wide
    the chart got letterboxed (huge empty space). Let the SVG size itself by
    aspect ratio so the panel height feels natural on iPhone.
  */
  .gtt-graph-svg{ height: auto; aspect-ratio: 520 / 320; }
}

/* Edit mode: keep the same clean black outline (no green accent). */
.gtt-root.gtt-editing .gtt-habit{
  border-color: var(--gtt-border);
}
.gtt-root.gtt-editing .gtt-habit:hover{
  background: rgba(0,0,0,0.03);
  box-shadow: 0 16px 40px rgba(0,0,0,0.08);
}

/* Mobile chart framing + label legibility */
@media (max-width: 760px){
  /* Remove the inner frame (double border) so the graph fills better. */
  .gtt-graph-shell{ border: 0; padding: 8px; }
  .gtt-graph-panel{ padding: 8px; }

  /* Make axis labels easier to read. */
  .gtt-xlabels, .gtt-ylabel{
    font-size: 14px;
    fill: rgba(0,0,0,0.78);
  }
}

/* Clearer hover feedback for controls */
.gtt-btn:hover{ transform: translateY(-1px); }
.gtt-ctl:hover{ background: rgba(0,0,0,0.03); transform: translateY(-1px); }
.gtt-tab:hover{ opacity: 0.9; transform: translateY(-1px); }

/* =========================
   Clarity panel (circle + square)
   ========================= */
.gtt-clarity-panel{ padding: 10px; }
.gtt-clarity-shell{
  border: 3px solid var(--gtt-border);
  border-radius: var(--gtt-radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 180px 1fr 180px 240px;
  gap: 14px;
  align-items: center;
  background: #fff;
}

.gtt-clarity-shape{
  appearance: none;
  border: 3px solid var(--gtt-border);
  background: rgba(0,0,0,0.01);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  user-select: none;
  display: grid;
  place-items: center;
}
.gtt-clarity-shape:hover{
  background: rgba(0,0,0,0.03);
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.10);
}
.gtt-clarity-shape:active{ transform: translateY(1px); }

.gtt-clarity-circle{ width: 168px; height: 168px; border-radius: 999px; overflow: hidden; border: none; }
.gtt-clarity-square{ width: 168px; height: 168px; border-radius: 0px; }

/* Solid task square (no outline look) */
.gtt-clarity-square{ background:#111; border-color:#111; }
.gtt-clarity-square:hover{ background:#111; }

.gtt-clarity-circle img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gtt-clarity-hd{
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.gtt-clarity-sub{
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.72;
  font-weight: 800;
}
.gtt-clarity-stats{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 13px;
  font-weight: 900;
}
.gtt-clarity-stats .k{ opacity: 0.65; font-weight: 900; }
.gtt-clarity-stats .v{ text-align: right; }

.gtt-clarity-actions{
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.gtt-mini-btn{
  appearance: none;
  border: 2px solid var(--gtt-border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: transform 140ms ease, background 160ms ease;
}
.gtt-mini-btn:hover{ background: rgba(0,0,0,0.03); transform: translateY(-1px); }
.gtt-mini-btn:active{ transform: translateY(1px); }

.gtt-mini-check{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.gtt-mini-check .box{
  width: 18px; height: 18px;
  border: 2px solid var(--gtt-border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 12px;
}
.gtt-mini-btn.checked{
  background: rgba(0,0,0,0.06);
}


.gtt-tc-tabs{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.gtt-tc-body{
  display: block;
}
.gtt-task-clarity-legend{
  border-left: none;
  padding-left: 0;
}
.gtt-task-clarity-legend .row{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.gtt-task-clarity-legend .row:first-child{ margin-top: 12px; }
.gtt-task-clarity-legend .lbl{
  font-weight: 900;
  font-size: 12px;
  opacity: 0.72;
}
.gtt-task-clarity-legend .ic{
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}
.gtt-task-clarity-legend .ic svg{
  width: 32px;
  height: 32px;
}

/* =========================
   Notes / clarity session modal
   ========================= */
.gtt-modal-card.large{ width: min(920px, 96vw); }

.gtt-clarity-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.gtt-q{
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 12px;
}
.gtt-q .qrow{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: flex-start;
}
.gtt-q .gtt-qprompt{
  width: 100%;
  border: 2px solid var(--gtt-border);
  border-radius: 12px;
  padding: 10px;
  font-weight: 900;
  line-height: 1.2;
  resize: none;
  min-height: 54px;
}
.gtt-q textarea:not(.gtt-qprompt){
  width: 100%;
  margin-top: 10px;
  border: 2px solid var(--gtt-border);
  border-radius: 12px;
  padding: 10px;
  min-height: 96px;
  font-weight: 700;
}
.gtt-q .meta{
  font-size: 12px;
  font-weight: 900;
  opacity: 0.7;
  text-align: right;
}

.gtt-notes-list{
  border: 2px solid var(--gtt-border-soft);
  border-radius: 14px;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
}
.gtt-note-item{
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(0,0,0,0.01);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.gtt-note-item:last-child{ margin-bottom: 0; }
.gtt-note-item:hover{
  background: rgba(0,0,0,0.03);
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(0,0,0,0.10);
}
.gtt-note-item .top{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
  font-size: 12px;
  opacity: 0.8;
}
.gtt-note-item .body{
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: pre-wrap;
  line-height: 1.35;
}

/* Task clarity modal lists */
.gtt-lb{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.gtt-lb-item{
  border: 2px solid var(--gtt-border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(0,0,0,0.01);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.gtt-lb-item:hover{ background: rgba(0,0,0,0.03); transform: translateY(-2px); box-shadow: 0 18px 50px rgba(0,0,0,0.10); }
.gtt-lb-left{ display:flex; gap: 10px; align-items:center; min-width: 0; }
.gtt-lb-left .ic{ width: 34px; height: 34px; display:grid; place-items:center; }
.gtt-lb-left .ic svg{ width: 32px; height: 32px; }
.gtt-lb-left .nm{ font-weight: 900; text-transform: uppercase; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtt-lb-right{ text-align: right; font-weight: 900; font-size: 12px; opacity: 0.78; }
.gtt-lb-right .big{ font-size: 14px; opacity: 1; }

@media (max-width: 980px){
  .gtt-clarity-shell{ grid-template-columns: 160px 1fr; grid-template-rows: auto auto; }
  .gtt-task-clarity-legend{ border-left: none; padding-left: 0; border-top: none; padding-top: 0; }
  .gtt-clarity-square{ justify-self: start; }
}

@media (max-width: 520px){
  .gtt-clarity-shell{ grid-template-columns: 160px 1fr; grid-template-rows: auto auto; }
  .gtt-clarity-circle, .gtt-clarity-square{ justify-self: start; }
}

/* Override: topbar share icon uses inline SVG */
.gtt-link-ic{ width: 20px; height: 20px; display: inline-grid; place-items: center; }
.gtt-link-ic:before, .gtt-link-ic:after{ display:none !important; content:none !important; }
.gtt-link-ic svg{ width: 20px; height: 20px; }

/* Override: edit control uses inline SVG instead of text glyph */
.gtt-ctl-pencil::before{ display:none !important; content:none !important; }
.gtt-ctl-pencil svg{ width: 20px; height: 20px; }
