
*{margin:0;padding:0;box-sizing:border-box;}

/* ── TEC PAGE STYLES ── */
:root {
  --tec-bg:      #f0ede8;
  --tec-ink:     #0d1117;
  --tec-accent:  #1a4f8a;
  --tec-gold:    #c8922a;
  --tec-gold-lt: #e8b84b;
  --tec-rule:    #d4cfc9;
  --tec-muted:   #7a7269;
  --tec-info-bg: #eef3fb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tec-bg:      #0d1117;
    --tec-ink:     #e4dfd8;
    --tec-accent:  #4a9ade;
    --tec-gold-lt: #e8b84b;
    --tec-rule:    #1e2d3d;
    --tec-muted:   #8a8279;
    --tec-info-bg: #0f2035;
  }
}
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--tec-bg);
  color: var(--tec-ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  padding: 1rem 0 0.5rem;
}
.tec-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tec-header { border-bottom: 2px solid var(--tec-gold); padding-bottom: .6rem; }
.tec-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: .65rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--tec-muted); margin: 0 0 .15rem;
}
.tec-course-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem; font-weight: 400; margin: 0; line-height: 1.2;
  color: var(--tec-ink);
}
.tec-course-link {
  color: var(--tec-accent); text-decoration: none;
  border-bottom: 1px solid transparent;
}
.tec-course-link:hover { border-bottom-color: var(--tec-accent); }
.tec-info {
  background: var(--tec-info-bg); border: 1px solid var(--tec-rule);
  border-radius: 6px; overflow: hidden;
}
.tec-info-toggle {
  width: 100%; padding: 0.7rem 1rem; background: white; border: none;
  cursor: pointer; display: flex; align-items: center; gap: .7rem;
  text-align: left; transition: background .2s; position: relative;
}
.tec-info-toggle::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--tec-gold);
}
.tec-info-toggle:hover:not(.open) { background: #f7f3eb; }
.tec-info-toggle.open { background: var(--tec-accent); }
.tec-info-icon {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  background: #ede8dc; color: var(--tec-accent);
  transition: transform .3s ease;
}
.tec-info-toggle.open .tec-info-icon { transform: rotate(180deg); background: var(--tec-gold); color: white; }
.tec-info-title {
  flex: 1; font-family: 'Playfair Display', serif;
  font-size: 0.9rem; color: var(--tec-accent);
}
.tec-info-toggle.open .tec-info-title { color: #f7f3eb; }
.tec-info-badge {
  font-size: .6rem; letter-spacing: .08em;
  text-transform: uppercase; padding: .15rem .5rem; border-radius: 20px;
  background: #ede8dc; color: #6b6560;
}
.tec-info-toggle.open .tec-info-badge { background: rgba(255,255,255,.2); color: rgba(248,244,237,.7); }
.tec-info-body {
  padding: 0.8rem 1rem; border-top: 1px solid var(--tec-rule);
  display: grid; grid-template-columns: 1fr;
  gap: 0.8rem;
}
[hidden] { display: none !important; }
.tec-info-body h3 {
  font-family: 'DM Mono', monospace; font-size: .6rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--tec-gold); margin: 0 0 .3rem;
}
.tec-info-body p, .tec-info-body li { font-size: .78rem; line-height: 1.5; }
.tec-info-body ul, .tec-info-body ol { padding-left: 1rem; margin: 0; }

/* ── WIDGET COMPACTO ── */
.area-widget {
  --gf-bg:      #1a3a52;
  --gf-darker:  #0f2233;
  --gf-mid:     #1e4560;
  --gf-lt:      #2a5a7a;
  --gf-teal:    #b0ffff;
  --gf-gold-lt: #e8b84b;
  --gf-accent:  #fdb851;
  --gf-error:   #ff6b6b;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: #fff;
  background: var(--gf-bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  overflow: hidden;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid var(--gf-darker);
}

.area-header {
  background: var(--gf-darker);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gf-lt);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.area-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 0.9rem; font-weight: 400; color: var(--gf-teal);
}
.area-header span {
  font-family: 'DM Mono', monospace; font-size: 0.5rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gf-gold-lt);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.coords {
  position: absolute; top: 4px; right: 6px;
  font-family: 'DM Mono', monospace; font-size: 0.6rem;
  color: #1a3a52; background: rgba(255,255,255,0.85);
  padding: 0.12rem 0.4rem; border-radius: 3px;
  pointer-events: none; opacity: 0;
  transition: opacity 0.15s;
  backdrop-filter: blur(2px);
}
.canvas-wrap:hover .coords { opacity: 1; }

.area-panel {
  background: var(--gf-bg);
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--gf-lt);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ctrl-row label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--gf-teal);
  white-space: nowrap;
}
.ctrl-row input[type="range"] {
  flex: 1;
  min-width: 80px;
  accent-color: var(--gf-accent);
  height: 4px;
  border-radius: 3px;
}
.val {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--gf-gold-lt);
  min-width: 2.8rem;
  text-align: right;
}

.fn-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
}
.fn-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
}
.fn-line {
  width: 16px;
  height: 3px;
  flex-shrink: 0;
}
.fn-expr { color: rgba(176,255,255,0.8); white-space: nowrap; }

.area-total-panel {
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(176,255,255,0.12);
}
.area-row {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.1rem 0;
  flex-wrap: wrap;
}
.area-row b { color: var(--gf-gold-lt); }
.rsq { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.total-area {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(176,255,255,0.2);
  font-weight: bold;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  margin-top: 0.3rem;
}
.litem {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.55rem;
  color: #8b949e;
}
.lsq {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.btn-reset {
  padding: 0.2rem 0.6rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: #002800;
  background: var(--gf-accent);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.14s;
}
.btn-reset:active { transform: scale(0.96); }

@media (max-width: 480px) {
  body { padding: 0.5rem 0 0.3rem; }
  .tec-page { padding: 0 0.5rem; gap: 0.8rem; }
  .tec-course-title { font-size: 1rem; }
  .area-header h2 { font-size: 0.8rem; }
  .ctrl-row label { font-size: 0.6rem; }
  .val { font-size: 0.6rem; min-width: 2.4rem; }
}

