/* ============ PALETTE ============ */
:root {
  --magenta: #ff0055;
  --yellow:  #ffbf00;
  --azure:   #00bfff;
  --gray:    #a8a8a8;

  --bg:    #0a0a0a;
  --fg:    #e8e8e8;
  --muted: #a8a8a8;

  --w:      560px;
  --radius: 26px; /* nuovo raggio globale */
}

/* Continuous angle globale per i componenti principali */
.chip,
.btn,
.action-btn,
.card,
.card--neutral,
.input,
#toast,
.file-placeholder__remove {
  border-radius: var(--radius);
  border-radius: var(--radius) / var(--radius);
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; }

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

:focus-visible {
  outline: 2px solid var(--azure);
  outline-offset: 2px;
  border-radius: 26px;
}

/* ============ LAYOUT ============ */
.wrap { max-width: 100%; padding: 20px 14px 60px; margin: 0 auto; }

.brand { display: flex; justify-content: center; padding: 10px 0 6px; max-width: var(--w); margin: 0 auto; }
.brand__logo { width: 100%; max-width: var(--w); height: auto; display: block; }

.panel { margin: 10px auto 0; max-width: var(--w); }

.panel--narrow .row { margin-top: 15px; }

/* ============ RIGHE ============ */
.row {
  display: flex;
  gap: 15px;
}

.row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ============ CHIP BUTTONS ============ */
.chip {
  appearance: none;
  border: 2px solid rgba(255,255,255,.18);
  background: transparent;
  color: var(--fg);
  padding: 16px 18px;
  cursor: pointer;
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: .06em;
  flex: 1 1 0;
  min-width: 0;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, color .15s ease, filter .12s ease;
}

.chip:hover { transform: translateY(-1px); }
.chip:active { transform: translateY(0); }

.chip--cyan {
  border-color: var(--yellow);
  background: rgba(255,191,0,0.10);
}
.chip--cyan.is-active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #111;
}
.chip--cyan.is-active:hover { filter: brightness(0.95); }
.chip--cyan:hover:not(.is-active) { background: rgba(255,191,0,0.15); }

.chip--magenta {
  border-color: var(--azure);
  background: rgba(0,191,255,0.10);
}
.chip--magenta.is-active {
  background: var(--azure);
  border-color: var(--azure);
  color: #fff;
}
.chip--magenta.is-active:hover { filter: brightness(0.95); }
.chip--magenta:hover:not(.is-active) { background: rgba(0,191,255,0.15); }

/* ============ BUTTONS ============ */
.btn {
  appearance: none;
  cursor: pointer;
  width: 100%;
  border: 2px solid rgba(255,255,255,.18);
  background: transparent;
  color: var(--fg);
  padding: 16px 18px;
  font-size: .98rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--outline { border-color: var(--magenta); max-width: var(--w); margin: 0 auto; }
.btn--outline:hover { background: rgba(255,0,85,.12); }

.btn--accent {
  width: auto;
  align-self: flex-end;
  border-color: var(--magenta);
  background: var(--magenta);
  color: #fff;
}
.btn--accent:hover { background: #cc0044; border-color: #cc0044; }

/* ============ CARD ============ */
.card {
  margin: 15px auto 0;
  max-width: var(--w);
  position: relative;
  padding: 16px;
  background: #121212;
  border: 2px solid var(--yellow);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  transition: border-color .15s ease;
}

.card--neutral {
  border: 2px solid #2a2a2a;
}

/* decrypt mode */
[data-mode="decrypt"] .card:not(.card--neutral) {
  border-color: var(--azure) !important;
}

/* header */
.card__header {
  padding: 2px 15px 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card__header h2 {
  margin: 0;
  font: 600 1.0rem/1 "IBM Plex Mono", monospace;
  color: var(--muted);
  text-transform: none;
  letter-spacing: .04em;
}

.header-attachment-icon {
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.header-attachment-icon:hover { opacity: 1; transform: scale(1.05); }
.header-attachment-icon:active { transform: scale(0.95); }

/* body */
.card__body {
  position: relative;
  padding: 0 2px;
  margin-top: 10px;
}

.file-placeholder {
  position: absolute;
  inset: 12px 12px auto 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
  pointer-events: auto;
}

.file-placeholder__icon,
.file-placeholder__name { pointer-events: none; }

.file-placeholder__icon {
  height: 28px;
  width: auto;
  opacity: .95;
}

.file-placeholder__name {
  font: 600 1.05rem/1 "IBM Plex Mono", monospace;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--w) - 28px - 64px);
}

.file-placeholder__remove {
  border: 2px solid #a6a6a6;
  background: #121212;
  color: #a6a6a6;
  font: 700 14px/1 "IBM Plex Mono", monospace;
  padding: 2px 6px;
  cursor: pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, color .12s ease;
}
.file-placeholder__remove:hover { background: rgba(166,166,166,.12); }
.file-placeholder__remove:active { transform: scale(.96); }

/* textarea */
.input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 12px 12px 14px;
  background: #0f0f0f;
  color: var(--fg);
  border: 2px solid #2a2a2a;
  outline: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  transition: border .15s ease, box-shadow .15s ease;
  overflow-y: auto;
  scrollbar-width: none;
}
.input::-webkit-scrollbar { width: 0; height: 0; }
.input::-webkit-resizer { display: none; }
.input:focus,
.input:focus-visible {
  border-color: #2a2a2a !important;
  outline: none;
  box-shadow: none;
}

/* footer */
.card__footer {
  padding-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#bottomEncrypt {
  width: 50%;
  max-width: calc((var(--w) - 10px) / 2);
  box-sizing: border-box;
}
#bottomEncrypt.btn--accent { align-self: center; }

/* ============ OUTPUT BUTTONS ============ */
.card__actions {
  margin-top: 15px;
  margin-bottom: 15px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.action-btn {
  appearance: none;
  cursor: pointer;
  width: 100%;
  max-width: calc((var(--w) - 10px) / 2);
  border: 2px solid #a6a6a6;
  background: transparent;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.06s ease, border-color 0.15s ease;
}

.action-btn img {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.action-btn:hover {
  background: rgba(166, 166, 166, 0.1);
  transform: translateY(-1px);
}
.action-btn:active { transform: translateY(0); }

/* ============ TOAST ============ */
#toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: 78vw;
  padding: 10px 12px;
  background: #111;
  color: var(--fg);
  border: 1px solid #2a2a2a;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  font-size: .9rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
#toast.show { opacity: 1; transform: translateY(0); }

#toast.toast--encrypt {
  border-color: var(--yellow);
  background: rgba(255,191,0,.15);
  color: #111;
}
#toast.toast--decrypt {
  border-color: var(--azure);
  background: rgba(0,191,255,.12);
  color: #fff;
}

/* ============ MEDIA QUERIES ============ */
@media (min-width: 640px) {
  .wrap { padding: 26px 24px 80px; }
  .card { margin-top: 15px; }
}

@media (min-width: 960px) {
  :root { --w: 560px; }
}
