:root {
  --fondo: #fafafa;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #6f6f77;
  --grigio-chiaro: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.09);
  --campo: #f4f4f5;
  --accento: #5b5bd6;
  --spunta: #1f9d55;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.keys {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 20px;
  padding: clamp(16px, 4.6vmin, 24px);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 18px 48px -18px rgba(17, 17, 19, 0.16);
}

.keys__head { display: flex; gap: 12px; align-items: flex-start; }

.keys__mark {
  flex: none;
  width: 30px; height: 30px;
  padding: 6px;
  border-radius: 9px;
  background: var(--inchiostro);
  fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round;
}

.keys__brand { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.keys__brand span { color: var(--grigio-chiaro); font-weight: 500; }
.keys__sub { margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--grigio); }

.keys__row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: clamp(14px, 4vmin, 22px);
  margin-bottom: 8px;
}
.keys__label { font-size: 13px; font-weight: 600; }
.keys__scope {
  font-size: 11.5px; font-weight: 550; color: var(--grigio);
  padding: 3px 8px; border-radius: 99px; background: var(--campo);
}

.field {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 46px;
  padding: 0 6px 0 14px;
  border-radius: 12px;
  background: var(--campo);
  border: 1px solid var(--bordo);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field.is-fresh { border-color: var(--accento); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accento) 16%, transparent); background: #fff; }

.field__key {
  flex: 1; min-width: 0;
  display: block;
  white-space: nowrap; overflow: hidden;
  font-family: var(--mono);
  font-size: clamp(10.5px, 3.1vw, 13.5px);
  letter-spacing: 0.01em;
  color: var(--inchiostro);
}
.field__key .c { display: inline-block; width: 1ch; text-align: center; }
.field__key .c.is-mask { color: var(--grigio-chiaro); }
.field__key .c.is-noise { color: var(--accento); }

.field__tools { flex: none; display: flex; align-items: center; gap: 2px; }
.tools__sep { width: 1px; height: 18px; background: var(--bordo); margin: 0 2px; }

.tool {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--grigio);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tool.is-hover { background: rgba(17, 17, 19, 0.06); color: var(--inchiostro); }
@media (hover: hover) { .tool:hover { background: rgba(17, 17, 19, 0.06); color: var(--inchiostro); } }
.tool:focus-visible, .ghostbtn:focus-visible, .solidbtn:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

.tool__icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.eye__pupil { fill: currentColor; stroke: none; }
.copy__check { stroke: var(--spunta); stroke-width: 2.2; }

.tool__tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px);
  padding: 4px 8px; border-radius: 7px;
  background: var(--inchiostro); color: #fff;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
}

.tool__tip::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  margin-left: -4px;
  border: 4px solid transparent; border-top-color: var(--inchiostro);
}
.tool[aria-pressed="true"] { color: var(--accento); }

.keys__meta { display: flex; flex-wrap: wrap; margin-top: 9px; font-size: 12px; color: var(--grigio-chiaro); }
.keys__gap { width: 14px; }

.keys__foot {
  position: relative;
  margin-top: clamp(14px, 4vmin, 20px);
  padding-top: clamp(12px, 3.4vmin, 16px);
  border-top: 1px solid var(--bordo);
  min-height: 52px;
}
.foot__idle, .foot__ask { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.foot__ask { position: absolute; inset: auto 0 0 0; top: clamp(12px, 3.4vmin, 16px); visibility: hidden; }
.foot__note, .foot__warn { font-size: 12.5px; line-height: 1.35; color: var(--grigio); }
.foot__warn { color: #b4232c; font-weight: 550; }
.foot__btns { display: flex; gap: 6px; flex: none; }

.ghostbtn, .solidbtn {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 10px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ghostbtn { background: #fff; color: var(--inchiostro); border: 1px solid var(--bordo); box-shadow: 0 1px 2px rgba(17, 17, 19, 0.05); }
.ghostbtn--plain { box-shadow: none; }
.ghostbtn.is-hover { background: var(--campo); }
@media (hover: hover) { .ghostbtn:hover { background: var(--campo); } }
.ghostbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.solidbtn { background: var(--inchiostro); color: #fff; border: 1px solid var(--inchiostro); box-shadow: 0 6px 14px -6px rgba(17, 17, 19, 0.5); }
.solidbtn.is-hover { background: #2a2a2e; }
@media (hover: hover) { .solidbtn:hover { background: #2a2a2e; } }

.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 380px) {
  .foot__note { font-size: 11.5px; }
  .foot__warn { font-size: 11.5px; }
  .ghostbtn, .solidbtn { padding: 0 10px; font-size: 12.5px; }
}
