/* Candle Intern tools: avatar maker + excuse card. Homemade look, real usability. */
.t-root, .t-root *, .t-root *::before, .t-root *::after { box-sizing: border-box; }
.t-root {
  max-width: 980px; margin: 0 auto; color: var(--ink);
  font-family: var(--f-body, 'Rubik', system-ui, sans-serif); font-size: 16px; line-height: 1.4;
}
.t-panel {
  position: relative; background: var(--paper); border: 2px solid var(--ink);
  border-radius: 6px 11px 5px 13px; padding: 30px 14px 18px;
  box-shadow: 6px 7px 0 rgba(58, 36, 24, .25);
}
.t-tape {
  position: absolute; top: -15px; left: 18px; transform: rotate(-2.5deg);
  background: rgba(226, 207, 162, .92); border: 1px solid rgba(58, 36, 24, .2);
  padding: 3px 16px; font: 14px/1.3 var(--f-type); color: var(--ink); max-width: calc(100% - 36px);
  clip-path: polygon(0 0, 100% 0, 98% 50%, 100% 100%, 0 100%, 2% 50%);
}
.t-grid { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 780px) {
  .t-panel { padding: 34px 24px 22px; }
  .t-grid { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
  .t-stage { position: sticky; top: 16px; align-self: start; } /* preview follows the long control column */
}
.t-stage { min-width: 0; }
.t-canvas {
  display: block; width: 100%; max-width: 420px; height: auto; aspect-ratio: 1 / 1; margin: 0 auto;
  background: #fff; border: 2px solid var(--ink); border-radius: 4px 9px 3px 10px;
  box-shadow: 4px 4px 0 rgba(58, 36, 24, .22);
}
.t-drag { touch-action: none; cursor: grab; }
.t-drag:active { cursor: grabbing; }
.t-pen {
  margin: 12px 0 0; font: 22px/1.1 var(--f-hand); color: var(--pen);
  text-decoration: underline wavy var(--pen); text-decoration-thickness: 1.5px; text-underline-offset: 5px;
  text-align: center;
}
.t-ctrl { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.t-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.t-h {
  display: block; padding: 0; margin: 0 0 6px; font: 15px/1.2 var(--f-type); text-transform: uppercase; letter-spacing: .04em;
}
.t-h::after { content: ''; display: block; height: 3px; margin-top: 3px; width: 64px; background: var(--orange); border-radius: 3px 1px 4px 1px; transform: rotate(-1deg); }
.t-row { display: grid; gap: 8px; }
.t-row--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.t-row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.t-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.t-thumb, .t-sw, .t-style {
  position: relative; width: 100%; max-width: 76px; aspect-ratio: 1 / 1; min-width: 44px; min-height: 44px; padding: 4px; margin: 0;
  background: #fff; border: 2px solid var(--ink); border-radius: 6px 10px 5px 9px; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center; font: inherit;
}
.t-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.t-thumb[aria-pressed="true"] { background: var(--candle); box-shadow: 3px 3px 0 var(--ink); }
.t-thumb.t-sel { outline: 3px dashed var(--pen); outline-offset: 2px; }
.t-sw { padding: 0; }
.t-sw[aria-pressed="true"], .t-style[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink); }
.t-sw[aria-pressed="true"]::after {
  content: '\2713'; font: 22px/1 var(--f-hand); color: var(--ink); text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper);
}
.t-sw--night[aria-pressed="true"]::after { color: var(--candle); text-shadow: none; }
.t-row .t-sw { border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%; }

.t-style { aspect-ratio: auto; max-width: none; padding: 6px; flex-direction: column; gap: 6px; font: 13px/1.15 var(--f-type); text-align: center; min-height: 84px; }
.t-style i { display: block; width: 100%; flex: 1; min-height: 40px; border: 1px solid rgba(58, 36, 24, .35); border-radius: 2px; }
.t-style--memo i { background: #FFF8E7 repeating-linear-gradient(0deg, rgba(70,110,170,.35) 0 1px, transparent 1px 8px), repeating-linear-gradient(90deg, rgba(70,110,170,.35) 0 1px, transparent 1px 8px); }
.t-style--sticky i { background: #FFE066; box-shadow: inset 0 8px 0 -3px rgba(255,248,231,.7); }
.t-style--napkin i { background: radial-gradient(circle at 70% 35%, transparent 0 9px, rgba(120,70,30,.45) 10px 12px, transparent 13px), #FCF6E6; }

.t-sel-label { margin: 2px 0 0; font: 14px/1.3 var(--f-type); min-height: 1.4em; }
.t-slider { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 8px; font: 14px var(--f-type); }
.t-slider label { margin: 0; }
.t-range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.t-range:disabled { opacity: .4; cursor: not-allowed; }
.t-range::-webkit-slider-runnable-track { height: 8px; background: var(--ink); border-radius: 6px 3px 6px 4px; }
.t-range::-moz-range-track { height: 8px; background: var(--ink); border-radius: 6px 3px 6px 4px; }
.t-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; background: var(--orange); border: 2px solid var(--ink); border-radius: 50%; }
.t-range::-moz-range-thumb { width: 24px; height: 24px; background: var(--orange); border: 2px solid var(--ink); border-radius: 50%; }

.t-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.t-btn {
  min-height: 44px; padding: 8px 14px; margin: 0; font: 15px/1.2 var(--f-type); color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 8px 4px 9px 5px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.t-btn:hover { transform: rotate(-1deg); }
.t-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.t-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.t-btn--go { background: var(--orange); color: var(--paper); font: 22px/1 var(--f-hand); padding: 8px 20px; letter-spacing: .02em; }
.t-btn--x { background: var(--night); color: var(--paper); }
.t-out { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.t-note {
  margin: 4px 0 0; padding: 10px 12px; background: var(--candle); color: var(--ink); font: 13px/1.35 var(--f-type);
  transform: rotate(-1.2deg); box-shadow: 2px 3px 0 rgba(58, 36, 24, .25); max-width: 340px; align-self: flex-start;
}
.t-status { margin: 0; min-height: 1.5em; font: 14px/1.4 var(--f-type); color: var(--pen); }

.t-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.t-count { font: 14px var(--f-type); }
.t-count.t-full { color: var(--pen); }
.t-text {
  display: block; width: 100%; min-height: 110px; margin: 0; padding: 10px 12px; resize: vertical;
  font: 22px/1.15 var(--f-hand); color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 5px 9px 4px 10px;
  background-image: repeating-linear-gradient(transparent 0 24px, rgba(70,110,170,.18) 24px 25px);
}

.t-root :focus-visible { outline: 3px solid var(--night); outline-offset: 2px; box-shadow: 0 0 0 6px var(--candle); }
.t-range:focus-visible { box-shadow: none; outline-offset: 0; }

.t-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; background: rgba(30, 35, 71, .9); color: var(--paper); font: 15px/1.4 var(--f-type); text-align: center;
}
.t-overlay img { max-width: 100%; max-height: 68vh; border: 3px solid var(--paper); background: #fff; -webkit-touch-callout: default; user-select: auto; }
.t-overlay p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .t-btn, .t-btn:hover, .t-btn:active { transition: none; transform: none; }
}
@media (min-width: 1000px) {
  .t-grid { grid-template-columns: var(--cv, 420px) minmax(0, 1fr); }
  .t-canvas { max-width: var(--cv, 420px); }
  .t-ctrl { display: block; columns: 2; column-gap: 18px; } /* controls in two columns so the tool fits one screen */
  .t-ctrl > * { break-inside: avoid; margin-bottom: 12px; }
}
