/* Decoreba PWA — medidas em pontos iOS, extraídas de WordViewController.xib.
   O palco (#stage) tem 480x300, como a view original em paisagem, e é escalado para caber na tela. */

@font-face {
  /* Substituta da Noteworthy-Bold fora de aparelhos Apple (onde a Noteworthy existe no sistema) */
  font-family: "DecorebaHand";
  src: url("../fonts/kalam-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --s: 1;          /* escala do palco */
  --x: 0px;        /* deslocamento horizontal do palco */
  --y: 0px;        /* deslocamento vertical do palco */
  --bg: #e9e5da;   /* IBUIBackgroundColor da view raiz: 0.914 0.898 0.855 */
  --ease: cubic-bezier(0.42, 0, 0.58, 1); /* UIViewAnimationCurveEaseInOut */
  --dur: 0.3s;     /* setAnimationDuration:0.3 */
  --helvetica: Helvetica, "Helvetica Neue", Arial, sans-serif;
  --noteworthy: Noteworthy, "DecorebaHand", "Marker Felt", cursive;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

/* Barra de navegação e faixa prolongadas nas laterais, para telas mais largas que 16:10 */
#navExt, #faixaExt {
  position: fixed;
  left: 0;
  right: 0;
  background-size: 100% 100%;
  pointer-events: none;
}
#navExt   { top: var(--y); height: calc(59px * var(--s)); background-image: url(../img/navigation.png); }
#faixaExt { top: calc(var(--y) + 59px * var(--s)); height: calc(5px * var(--s)); background-image: url(../img/faixa.png); }

#stage {
  position: fixed;
  left: var(--x);
  top: var(--y);
  width: 480px;
  height: 300px;
  transform: scale(var(--s));
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--helvetica);
}

#stage img { position: absolute; display: block; pointer-events: none; -webkit-user-drag: none; }

button {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent no-repeat 0 0 / 100% 100%;
  font: inherit;
  color: inherit;
  cursor: pointer;
  outline: none;
}
button:focus-visible, #imageViewChecker:focus-visible { outline: 2px solid #3f6fb6; outline-offset: 1px; }

/* adjustsImageWhenHighlighted: o UIButton escurece a imagem enquanto está pressionado */
.btImg:active, .tabBg:active, .btImg.pressed, .tabBg.pressed { filter: brightness(0.62); }
.btImg img { position: static !important; width: 100%; height: 100%; }

/* Views animadas (UIView beginAnimations / commitAnimations) */
.anim {
  transition: top var(--dur) var(--ease), left var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.noanim { transition: none !important; }
.off { pointer-events: none !important; }     /* alpha 0: não recebe toques */
.hidden { visibility: hidden !important; }    /* setHidden:YES */

/* ---------- Abas: Tradução, Particípio, Passado ---------- */
.tab { position: absolute; left: 0; top: 64px; width: 480px; opacity: 0; }
#viewTranslate  { height: 196px; }
#viewParticiple { height: 151px; }
#viewPast       { height: 105px; }
.tabBg { left: 0; top: 0; width: 100%; height: 100%; }

.tabLabel {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  color: #fff;
  pointer-events: none;
}
.tabLabel > div, .tx > div { white-space: nowrap; overflow: hidden; }
.tabLabel span { display: inline-block; }
.tw {
  font-family: var(--noteworthy);
  font-weight: 700;
  font-size: 35px;
  line-height: 1.05;
}
/* Exemplo de aplicação */
.tx { margin-top: 3px; font-family: var(--helvetica); }
.txCap { font-size: 10px; font-weight: 700; line-height: 13px; opacity: .78; }
.txEn { font-size: 14px; line-height: 18px; }
.txEn b { font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
#labelTranslate  { text-shadow: 0 2px 0 rgb(144, 145, 79); }
#labelTranslate .tx  { text-shadow: 0 1px 0 rgb(120, 121, 60); }
#labelParticiple { text-shadow: 0 2px 0 rgb(0, 152, 164); }
#labelParticiple .tx { text-shadow: 0 1px 0 rgb(0, 120, 130); }
#labelPast       { text-shadow: 0 2px 0 rgb(185, 54, 46); }
#labelPast .tx       { text-shadow: 0 1px 0 rgb(150, 40, 34); }

.sound { width: 34px; height: 35px; }

/* ---------- Lista ---------- */
#viewList { position: absolute; left: 0; top: 480px; width: 480px; height: 274px; opacity: 0; }
#labelList {
  position: absolute;
  left: 219px; top: 13px; width: 42px; height: 21px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #fff;
  pointer-events: none;
}
#tableViewList {
  position: absolute;
  left: 0; top: 40px; width: 480px; height: 230px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
}
#tableViewList::-webkit-scrollbar { display: none; }

.cell {
  position: relative;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 27px;
  text-shadow: 0 2px 0 rgb(38, 38, 38);
  background: url(../img/lineLista.png) no-repeat 0 48px / 480px 2px;
  cursor: pointer;
  white-space: nowrap;
}
.cell .marca {
  position: absolute;
  left: 410px; top: 0; width: 40px; height: 39px;
  background: url(../img/marcaLista.png) no-repeat 0 0 / 100% 100%;
}

/* ---------- Barra superior ---------- */
#navigation { left: 0; top: 0; width: 480px; height: 59px; }
#faixa      { left: 0; top: 59px; width: 480px; height: 5px; }


#scrollViewWords {
  position: absolute;
  left: 89px; top: 4px; width: 302px; height: 51px;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}
#scrollViewWords.dragging { cursor: grabbing; }
#scrollTrack { position: absolute; left: 0; top: 0; height: 51px; display: flex; will-change: transform; }
.word {
  flex: 0 0 302px;
  height: 51px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 45px;
  color: rgb(63, 63, 63);
  text-shadow: 0 2px 0 rgb(226, 224, 214);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

#buttonSoundInfinitive { left: 436px; top: 12px; }
#buttonArrowRight { left: 394px; top: 12px; width: 36px; height: 36px; }
#buttonArrowLeft  { left: 51px;  top: 15px; width: 36px; height: 36px; }
#buttonArrowRight img, #buttonArrowLeft img { width: 23px; height: 24px; margin: 6px 6.5px; }

#stage #imageViewChecker { left: 19px; top: 54px; width: 51px; height: 48px; pointer-events: auto; cursor: pointer; }

#buttonCancel { left: 12px; top: 11px; width: 60px; height: 37px; opacity: 0; }
#buttonBusca  { left: 411px; top: 12px; width: 60px; height: 37px; opacity: 0; }

#viewBusca { position: absolute; left: 90px; top: 13px; width: 301px; height: 34px; opacity: 0; }
#textFieldBusca {
  position: absolute;
  left: 36px; top: 2px; width: 232px; height: 31px;
  border: 0;
  outline: none;
  background: transparent;
  color: #000;
  font-family: var(--helvetica);
  font-size: 14px;
  padding: 0;
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
#buttonLimpaBusca { left: 274px; top: 6px; width: 21px; height: 21px; }

/* ---------- Launch image ---------- */
#splash {
  position: absolute;
  inset: 0;
  background: url(../img/splash-landscape.png) no-repeat 0 0 / 100% 100%;
}
#splash.gone { display: none; }
body.launching { background: #d7d4c5; }
body.launching #navExt, body.launching #faixaExt { visibility: hidden; }

/* ---------- Retrato: o app original só aceita paisagem ---------- */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  background: #cdc9ba url(../img/splash-portrait.png) no-repeat center / contain;
  z-index: 10;
}
#rotate p {
  position: absolute;
  left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font: 17px/1.3 var(--helvetica);
  color: #555;
}
@media (orientation: portrait) and (max-width: 820px) {
  #rotate { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0.01s; }
}

/* ---------- Wizard: adicionar à tela inicial ----------
   Painel no estilo da lista (bgLista.png), que sobe de baixo. Os números dos passos usam as cores das abas. */
#wizard {
  --wz-dark: #404141;
  --wz-red: #e24a3b;      /* aba Passado */
  --wz-cyan: #12bccb;     /* aba Particípio */
  --wz-olive: #b1b264;    /* aba Tradução */
  --wz-text: #f4f2ea;
  --wz-muted: #c9c7bf;
  position: absolute;
  left: 0; top: 300px; width: 480px; height: 300px;
  background:
    url(../img/bgLista.png) no-repeat 0 0 / 480px 274px,
    linear-gradient(#404141, #404141) no-repeat 0 268px / 480px 32px;
  color: var(--wz-text);
  visibility: hidden;
  transition: top 0.4s var(--ease), visibility 0s linear 0.4s;
  z-index: 5;
}
#wizard.shown { top: 0; visibility: visible; transition: top 0.4s var(--ease), visibility 0s; }

.wzHead {
  position: absolute;
  left: 24px; right: 16px; top: 36px; height: 40px;
  display: flex; align-items: center; gap: 10px;
}
#stage .wzIcon { position: static; width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.wzHead h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.15; text-shadow: 0 1px 0 #262626; }
.wzHead p { margin: 2px 0 0; font-size: 11px; color: var(--wz-muted); }
.wzX {
  position: static; margin-left: auto; width: 30px; height: 30px;
  font-size: 22px; line-height: 28px; color: var(--wz-muted); border-radius: 15px;
}
.wzX:active { background: rgba(255,255,255,.1); }

.wzViewport { position: absolute; left: 0; top: 84px; width: 480px; height: 162px; overflow: hidden; }
.wzTrack { display: flex; height: 100%; transition: transform 0.3s var(--ease); }
.wzStep { flex: 0 0 480px; height: 100%; position: relative; }

.wzText { position: absolute; left: 24px; top: 4px; width: 236px; }
.wzNum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
  margin-bottom: 8px;
}
.wzText h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 0 #262626; }
.wzText p { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--wz-muted); }
.wzText p + p { margin-top: 6px; }
.wzText strong { color: var(--wz-text); font-weight: 700; }
.wzInline { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; }

/* Ilustrações (miniaturas das telas do sistema) */
.wzArt {
  position: absolute; left: 280px; top: 4px; width: 176px; height: 150px;
  border-radius: 12px; overflow: hidden;
  background: #e9e5da;
  box-shadow: 0 2px 8px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.25);
  color: #1c1c1e; font-size: 10px;
}
.wzHi { position: relative; }
.wzHi::after {
  content: ""; position: absolute; inset: -4px; border-radius: 10px;
  border: 2px solid var(--wz-red);
  animation: wzPulse 1.4s ease-in-out infinite;
}
@keyframes wzPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.08); } }

/* iOS: barra do Safari */
.mkPage { position: absolute; left: 0; right: 0; top: 0; bottom: 44px; background: #e9e5da; }
.mkPage i { position: absolute; left: 14px; right: 14px; height: 8px; border-radius: 4px; background: #d3cfc2; }
.mkBar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44px;
  background: #f6f6f7; border-top: 1px solid #d1d1d6;
  display: flex; align-items: center; justify-content: space-around; padding: 0 6px;
  color: #0a84ff;
}
.mkBar svg { width: 16px; height: 16px; display: block; }
.mkBar span { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }

/* iOS: menu de compartilhamento / Android: menu do navegador */
.mkSheet { position: absolute; left: 10px; right: 10px; top: 10px; background: #fff; border-radius: 10px; overflow: visible; }
.mkRow {
  display: flex; align-items: center; justify-content: space-between;
  height: 30px; padding: 0 10px; font-size: 10.5px;
  border-bottom: 1px solid #e5e5ea; white-space: nowrap;
}
.mkRow:last-child { border-bottom: 0; }
.mkRow svg { width: 13px; height: 13px; color: #1c1c1e; flex: none; }
.mkRow.wzHi { background: #fff; border-radius: 6px; z-index: 1; }
.mkRow.wzHi::after { inset: -2px; border-radius: 7px; }
.mkDim { color: #8e8e93; }

/* iOS: confirmação */
.mkTop {
  position: absolute; left: 0; right: 0; top: 0; height: 34px; background: #f6f6f7;
  border-bottom: 1px solid #d1d1d6;
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px; font-size: 9.5px;
}
.mkTop b { font-weight: 700; }
.mkLink { color: #0a84ff; }
.mkLink.wzHi { font-weight: 700; padding: 2px 3px; }
.mkLink.wzHi::after { inset: -3px; border-radius: 6px; }
.mkApp { position: absolute; left: 12px; right: 12px; top: 46px; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 8px; padding: 8px; }
#stage .mkApp img, #stage .mkHome img { position: static; width: 32px; height: 32px; border-radius: 7px; }
.mkApp div { font-size: 11px; }
.mkApp small { display: block; color: #8e8e93; font-size: 8.5px; margin-top: 2px; }

/* Android: barra do Chrome */
.mkChrome {
  position: absolute; left: 0; right: 0; top: 0; height: 40px; background: #f1f3f4;
  display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; border-bottom: 1px solid #dadce0;
}
.mkUrl { flex: 1; height: 24px; border-radius: 12px; background: #fff; display: flex; align-items: center; padding: 0 8px; font-size: 9.5px; color: #5f6368; overflow: hidden; white-space: nowrap; }
.mkKebab { width: 22px; height: 24px; display: flex; align-items: center; justify-content: center; color: #3c4043; }
.mkKebab svg { width: 14px; height: 14px; }
.mkChromePage { position: absolute; left: 0; right: 0; top: 41px; bottom: 0; background: #e9e5da; }
.mkChromePage i { position: absolute; left: 14px; right: 14px; height: 8px; border-radius: 4px; background: #d3cfc2; }

/* Android: diálogo */
.mkDialog { position: absolute; left: 14px; right: 14px; top: 26px; background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.mkDialog h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; }
.mkDialog .mkAppLine { display: flex; align-items: center; gap: 8px; font-size: 10.5px; }
#stage .mkDialog img { position: static; width: 28px; height: 28px; border-radius: 6px; }
.mkActions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 14px; font-size: 10.5px; font-weight: 700; color: #1a73e8; }
.mkActions span { padding: 2px 4px; }

/* Tela inicial com o ícone */
.mkHome {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #2c5d8f, #1d3553 60%, #10202f);
  display: grid; grid-template-columns: repeat(4, 32px); grid-auto-rows: 47px;
  justify-content: space-evenly; align-content: start; padding-top: 10px;
}
.mkHome span { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1; font-size: 7.5px; color: #fff; }
.mkHome span i { width: 32px; height: 32px; border-radius: 7px; background: rgba(255,255,255,.22); }
.mkHome .wzHi::after { inset: -4px -4px 8px; border-radius: 10px; border-color: #fff; }

/* Instalação direta (Android com prompt nativo) */
.wzInstall {
  margin-top: 12px; height: 34px; padding: 0 16px; position: static;
  border-radius: 7px; background: var(--wz-cyan); color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.2);
}

/* Escurece o app por trás do wizard (inclusive as laterais em telas largas) */
#wzScrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); z-index: 4; }
body.wz-open #wzScrim { opacity: 1; pointer-events: auto; }
body { transition: background-color .4s var(--ease); }
body.wz-open { background-color: #75726d; }
#navExt, #faixaExt { transition: filter .4s var(--ease); }
body.wz-open #navExt, body.wz-open #faixaExt { filter: brightness(.5); }

/* Rodapé */
.wzFoot { position: absolute; left: 20px; right: 20px; bottom: 12px; height: 36px; display: flex; align-items: center; justify-content: space-between; }
.wzBtn {
  position: static; min-width: 92px; height: 34px; padding: 0 14px;
  border-radius: 7px;
  background: linear-gradient(#4b4c4c, #353636);
  border: 1px solid rgba(255,255,255,.28);
  color: var(--wz-muted); font-weight: 700; font-size: 13px;
  text-shadow: 0 -1px 0 #262626;
}
.wzBtn.wzPrimary { color: #fff; background: linear-gradient(#e85a4b, #c93c2f); border-color: rgba(255,255,255,.35); text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
.wzBtn:active, .wzInstall:active { filter: brightness(0.8); }
.wzDots { display: flex; gap: 6px; }
.wzDots i { width: 7px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.28); transition: background .2s; }
.wzDots i.on { background: #fff; }

@media (prefers-reduced-motion: reduce) {
  .wzHi::after { animation: none; }
  .wzTrack { transition: none; }
}
