/*
 * Settings menu (js/ajustos.js): a cog at the top right opens a sheet of
 * parchment with the player, sound, dark mode, the guide and signing out.
 */

/* Sound and theme now live in the menu; their buttons stay in the page for js/app.js. */
.topbar #btn-sound, .topbar #btn-theme { display: none; }
#btn-settings { display: grid; place-items: center; width: 44px; min-width: 44px; padding: 0; }
#btn-settings svg { width: 24px; height: 24px; transition: transform .4s cubic-bezier(.3, 1.4, .5, 1); }
#btn-settings:active svg, #btn-settings[aria-expanded="true"] svg { transform: rotate(60deg); }

dialog.ajustos {
  width: min(420px, calc(100% - 28px)); max-height: calc(100dvh - 40px); overflow-y: auto;
  margin: auto; padding: 18px 18px 14px; color: var(--text);
}
dialog.ajustos[open] { animation: aj-in .32s cubic-bezier(.3, 1.3, .5, 1); }
dialog.ajustos::backdrop { background: rgba(14, 10, 6, .62); backdrop-filter: blur(3px); }

.aj-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.aj-head h2 { font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.aj-close { font-size: 1rem; font-weight: 800; }

.aj-who { display: flex; align-items: center; gap: 14px; width: 100%; margin: 16px 0 6px; padding: 12px; border: 0; border-radius: 16px; background: var(--surface-2); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.aj-who:active { filter: brightness(.96); }
.aj-who .aj-see { margin-top: 2px; color: var(--accent); font-weight: 700; font-size: .85rem; }
.aj-av { display: block; flex: none; width: 58px; height: 58px; border-radius: 50%; overflow: hidden; background: var(--av); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.aj-av svg { display: block; width: 100%; height: 100%; }
.aj-who b { display: block; font-family: var(--display); font-size: 1.15rem; font-weight: 800; }
.aj-who small { display: block; color: var(--muted); font-size: .9rem; font-weight: 500; }

.aj-group { margin-top: 14px; border-radius: 16px; overflow: hidden; border: 2px solid var(--btn-line, var(--border)); background: var(--btn-face, var(--surface)); box-shadow: 0 4px 0 var(--btn-depth, var(--border)); }
.aj-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 14px; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.aj-row + .aj-row { border-top: 1.5px solid var(--border); }
.aj-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; }
.aj-ico svg { display: block; width: 30px; height: 30px; overflow: visible; }
.aj-label { flex: 1; font-weight: 700; line-height: 1.25; }
.aj-label small { display: block; margin-top: 1px; color: var(--muted); font-size: .8rem; font-weight: 550; }
.aj-go { font-size: 1.5rem; line-height: 1; color: var(--muted); }
.aj-act:active { background: var(--surface-2); }
.aj-danger .aj-label { color: var(--accent); }
.aj-foot { margin-top: 14px; text-align: center; color: var(--muted); font-size: .8rem; }

/* Group titles */
.aj-group-title { margin: 18px 4px -6px; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

/* Text size: three buttons under the row */
.aj-row.aj-text { cursor: default; }
.aj-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 12px 58px; }
.aj-seg button {
  min-height: 40px; padding: 4px 6px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface-2); color: inherit; font: inherit; font-weight: 750; cursor: pointer;
}
.aj-seg button[data-size="normal"] { font-size: .85rem; }
.aj-seg button[data-size="gran"] { font-size: 1rem; }
.aj-seg button[data-size="enorme"] { font-size: 1.15rem; }
.aj-seg button.on { background: #f2b705; border-color: #b88a00; color: #3a2408; box-shadow: 0 3px 0 #b88a00; }
.aj-seg button:active { transform: translateY(2px); }

/* Pages inside the menu: rules, terms, report, confirmations */
.aj-page-head { justify-content: flex-start; gap: 12px; }
.aj-page-head h2 { font-size: 1.45rem; }
.aj-back { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; padding: 0; }
.aj-back svg { width: 22px; height: 22px; }
.aj-page { margin-top: 14px; }
.aj-rules { font-size: .95rem; }
.aj-muted { color: var(--muted); font-size: .85rem; }
.aj-form { display: grid; gap: 8px; }
.aj-form label { font-weight: 750; margin-top: 6px; }
.aj-form input, .aj-form textarea {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); color: inherit; font: inherit; resize: vertical;
}
.aj-form .btn { margin-top: 10px; }
.aj-confirm { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 8px 4px 4px; }
.aj-confirm-ico svg { width: 64px; height: 64px; overflow: visible; animation: aj-wobble 1.6s ease-in-out infinite; }
.aj-confirm h3 { font-family: var(--serif); font-size: 1.4rem; }
.aj-confirm .btn { width: 100%; margin-top: 6px; }
.aj-foot { line-height: 1.5; }

/* The hidden switch that makes the iPhone's haptic tap */
.aj-haptic { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

@keyframes aj-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes aj-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.aj-form textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.aj-foot a { color: inherit; font-weight: 750; }
