:root {
  color-scheme: light;
  --paper: #f6eddd;
  --paper-deep: #ecdfc9;
  --surface: #fffaf0;
  --ink: #241d19;
  --muted: #6c5b4e;
  --line: #d9c8ad;
  --red: #742724;
  --red-deep: #511b1d;
  --yellow: #f4c43e;
  --yellow-deep: #d9a923;
  --success: #35553a;
  --danger: #8d2929;
  --radius-card: 18px;
  --radius-control: 9px;
  --radius-soft: 13px;
  --font-ui: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button, select, input[type="checkbox"], .drop-area { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .drop-area:focus-within {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.page-shell { width: min(1100px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid rgba(90, 57, 38, .16);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--red); }
.brand-name { font-size: 18px; letter-spacing: -.045em; }
.brand-name strong { color: var(--red); font-weight: 780; }
.account-area { display: flex; align-items: center; min-height: 44px; }
.signed-in { display: flex; align-items: center; gap: 18px; }
.member-label { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 9px 16px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-discord { color: #fff; background: #32364a; }
.button-discord:hover { background: #242838; }
.button-primary { color: #251c12; background: var(--yellow); border-color: #c69c27; }
.button-primary:hover:not(:disabled) { background: #f8d25b; }
.button-dark { color: #fffaf0; background: var(--red-deep); }
.button-dark:hover { background: #391214; }
.button-light { color: var(--red-deep); background: var(--surface); border-color: var(--line); }
.button-light:hover { background: var(--paper-deep); }
.text-button { min-height: 44px; border: 0; padding: 8px 4px; color: var(--red-deep); background: transparent; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: #311012; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(245px, .9fr);
  align-items: center;
  gap: 48px;
  min-height: 270px;
  padding: 34px 0 24px;
}
.intro-copy { max-width: 610px; }
.eyebrow, .section-kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .095em;
  text-transform: uppercase;
}
.intro h1 { margin: 0; font-size: clamp(38px, 6vw, 66px); font-weight: 790; letter-spacing: -.075em; line-height: .99; }
.intro h1 span { color: var(--red); }
.intro-text { max-width: 510px; margin: 17px 0 0; color: #57483e; font-size: 17px; }
.mascot-wrap { position: relative; display: grid; min-height: 210px; place-items: center; }
.mascot-disc { position: absolute; top: 50%; left: 50%; width: 192px; height: 192px; border: 1px solid rgba(116, 39, 36, .2); border-radius: 50%; background: var(--red); transform: translate(-50%, -50%) rotate(-7deg); }
.mascot { position: relative; width: 174px; height: 174px; border: 5px solid var(--paper); border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(36, 29, 25, .65); }
.mascot-caption { position: absolute; right: 8%; bottom: 5px; color: var(--red-deep); font-family: Georgia, serif; font-size: 16px; font-style: italic; transform: rotate(-4deg); }

.access-note { margin: 0 0 16px; border: 1px solid #c9a148; border-radius: var(--radius-control); padding: 12px 16px; color: #4a3414; background: #fff1bf; }
.composer, .result-panel, .paste-view {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.composer { padding: clamp(20px, 4vw, 36px); }
.composer-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.composer-heading .section-kicker { margin-bottom: 4px; }
.composer-heading h2, .result-panel h2 { margin: 0; font-size: 28px; letter-spacing: -.055em; line-height: 1.15; }
.member-required { margin: 0 0 2px; color: var(--muted); font-size: 13px; }

.mode-switch { display: flex; width: fit-content; max-width: 100%; gap: 4px; margin-bottom: 13px; border: 1px solid var(--line); border-radius: 11px; padding: 4px; background: #f4ebda; }
.mode-tab { min-height: 40px; border: 0; border-radius: 7px; padding: 8px 14px; color: #534237; background: transparent; font-weight: 650; cursor: pointer; }
.mode-tab.is-active { color: #fffaf0; background: var(--red-deep); }

.editor-panel, .file-panel { border: 1px solid var(--line); border-radius: var(--radius-soft); overflow: hidden; background: #fffdf8; }
.editor-toolbar { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 7px 12px 7px 16px; background: #f5eddf; }
.field-label { display: block; color: #45372f; font-size: 13px; font-weight: 750; }
.extension-controls { display: flex; gap: 8px; }
select, input[type="text"], input[type="password"], input[type="number"] { min-height: 42px; border: 1px solid #bda98d; border-radius: 7px; padding: 8px 11px; color: var(--ink); background: #fffdf8; }
.select-wrap { position: relative; display: block; min-width: 0; max-width: 100%; }
.select-wrap::after { position: absolute; top: 50%; right: 16px; width: 8px; height: 8px; border-right: 2px solid #725844; border-bottom: 2px solid #725844; content: ""; pointer-events: none; transform: translateY(-70%) rotate(45deg); }
.select-wrap:focus-within::after { border-color: var(--red); }
select { display: block; width: 100%; max-width: 100%; min-height: 48px; appearance: none; border: 1.5px solid #ad9677; border-radius: 10px; padding: 10px 44px 10px 14px; color: var(--ink); background: linear-gradient(180deg, #fffefa 0%, #f8f0e3 100%); box-shadow: 0 1px 2px rgba(45, 31, 20, .06); cursor: pointer; transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease; }
select:hover { border-color: #81533b; background: #fffaf0; box-shadow: 0 2px 7px rgba(69, 42, 24, .1); }
select:focus-visible { border-color: var(--red); box-shadow: 0 0 0 3px rgba(116, 39, 36, .14); outline: 0; }
select option, select optgroup { color: var(--ink); background: #fffaf0; }
input:hover { border-color: #8b6a49; }
.select-wrap-format { flex: 1 1 250px; min-width: 0; }
#extension { min-width: 0; }
#custom-extension { width: 148px; }
.selection-preview { display: flex; align-items: center; gap: 6px; margin: 9px 0 0; color: #665443; font-size: 12px; }
.extension-preview { margin: 10px 15px 0; padding-bottom: 2px; }
.selection-preview::before { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #53734b; content: ""; }
.selection-preview code { border: 1px solid #d8c8ad; border-radius: 5px; padding: 1px 5px; color: var(--red-deep); background: #f4ead8; font-family: var(--font-code); font-size: 11px; }
#paste-content { display: block; width: 100%; min-height: 235px; resize: vertical; border: 0; padding: 19px 20px; color: #26201b; background: #fffdf8; font-family: var(--font-code); font-size: 13px; line-height: 1.7; tab-size: 2; }
#paste-content:focus-visible { outline-offset: -4px; }
#paste-content::placeholder { color: #796b5d; opacity: 1; }
.editor-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #e6ddce; padding: 8px 14px; color: #6a5a4e; font-size: 12px; }
.character-count { white-space: nowrap; }

.file-panel { padding: 14px; }
.drop-area { display: grid; min-height: 180px; place-content: center; justify-items: center; border: 1.5px dashed #9c8060; border-radius: 10px; padding: 24px; background: #fcf5e9; text-align: center; cursor: pointer; }
.drop-area:hover { border-color: var(--red); background: #f8edda; }
.drop-title { font-size: 18px; font-weight: 760; letter-spacing: -.025em; }
.drop-subtitle { margin-top: 4px; color: var(--muted); }
.file-picker-label { display: inline-flex; min-height: 42px; align-items: center; margin-top: 16px; border: 1px solid #a38a6d; border-radius: 7px; padding: 7px 15px; color: var(--red-deep); background: var(--surface); font-weight: 700; }
.selected-file { max-width: 100%; margin-top: 9px; overflow-wrap: anywhere; color: #57483e; font-size: 13px; }
.upload-limit { margin: 9px 2px 2px; color: var(--muted); font-size: 12px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr); gap: 16px; margin-top: 18px; }
.setting-block { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-soft); padding: 17px; background: #fcf7ed; }
.expiry-controls { display: grid; gap: 10px; margin-top: 8px; }
.select-wrap-expiry, .select-wrap-unit { width: 100%; }
.custom-expiry { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 10px; border: 1px solid #ddcdb5; border-radius: 10px; padding: 10px; background: #f8f0e2; }
.custom-time-part { display: grid; min-width: 0; gap: 5px; color: #655342; font-size: 11px; font-weight: 700; }
#custom-amount { width: 100%; min-height: 48px; border-radius: 10px; }
#custom-unit { min-width: 0; }
.expiry-setting > .selection-preview { border: 1px solid #d9c9ae; border-radius: 9px; padding: 9px 11px; background: #fffaf0; }
.field-help { margin: 9px 0 0; color: #68584c; font-size: 12px; }
.toggle-row { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; margin-top: 7px; cursor: pointer; }
.toggle-copy { display: grid; gap: 1px; }
.toggle-copy strong { font-size: 14px; }
.toggle-copy small { color: #68584c; font-size: 12px; }
.switch-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.switch { position: relative; flex: 0 0 auto; width: 46px; height: 27px; border: 1px solid #8f7b64; border-radius: 20px; background: #e8dcc9; transition: background-color 140ms ease; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fffaf0; box-shadow: 0 1px 2px rgba(36, 29, 25, .2); content: ""; transition: transform 140ms ease; }
.switch-input:checked + .switch { border-color: var(--red-deep); background: var(--red-deep); }
.switch-input:checked + .switch::after { background: var(--yellow); transform: translateX(19px); }
.switch-input:focus-visible + .switch { outline: 3px solid var(--red); outline-offset: 3px; }
.code-toggle { display: flex; min-height: 42px; align-items: center; gap: 9px; margin-top: 4px; color: #45372f; font-size: 13px; font-weight: 650; cursor: pointer; }
.code-toggle input { width: 17px; height: 17px; accent-color: var(--red); }
.code-field input { width: 100%; }

.form-feedback { min-height: 21px; margin: 9px 0 0; color: var(--danger); font-size: 13px; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 17px; }
.submit-note { max-width: 450px; margin: 0; color: #68584c; font-size: 13px; }
#create-button { min-width: 165px; }

.result-panel { margin-top: 20px; padding: clamp(20px, 4vw, 32px); }
.result-topline { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--success); font-size: 13px; font-weight: 750; }
.result-check { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 14px; }
.result-panel > p { color: var(--muted); }
.share-field { display: flex; gap: 8px; }
.share-field input { flex: 1 1 auto; min-width: 0; }
.copy-feedback { min-height: 20px; margin: 7px 0 0; color: var(--success); font-size: 13px; }
.create-another { margin-top: 8px; }

.paste-view { margin-top: 22px; padding: clamp(18px, 4vw, 34px); }
.back-link { display: inline-flex; min-height: 44px; align-items: center; color: var(--red-deep); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.paste-view-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 8px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.paste-view-heading h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(27px, 4vw, 40px); letter-spacing: -.06em; line-height: 1.1; }
.paste-kind-label { margin: 0 0 5px; }
.expiry-stamp { margin: 0; color: #6c5b4e; font-size: 13px; text-align: right; }
.paste-state { margin: 18px 0; border-radius: 9px; padding: 13px 15px; color: #493a2f; background: #f4ead7; }
.paste-state.is-error { color: #742724; background: #f7e1dc; }
.paste-state.is-success { color: #35553a; background: #e3eddf; }
.open-form { max-width: 540px; margin-top: 20px; }
.open-form .share-field { margin-top: 7px; }
.content-panel { margin-top: 17px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fffdf8; }
.content-toolbar { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 8px 12px 8px 17px; background: #f5eddf; }
.file-name { min-width: 0; overflow-wrap: anywhere; color: #44372e; font-family: var(--font-code); font-size: 13px; }
.content-actions { display: flex; flex: 0 0 auto; gap: 8px; }
#opened-content { max-height: 65vh; min-height: 200px; overflow: auto; margin: 0; padding: 20px; color: #241e19; background: #fffdf8; font-family: var(--font-code); font-size: 13px; line-height: 1.7; tab-size: 2; white-space: pre; }
#opened-content code { font: inherit; }

.footer { display: flex; justify-content: space-between; gap: 16px; padding: 21px 2px 30px; color: #65564a; font-size: 12px; }
.footer p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 32px, 620px); }
  .topbar { min-height: 72px; }
  .brand img { width: 42px; height: 42px; }
  .intro { grid-template-columns: minmax(0, 1fr) 145px; gap: 10px; min-height: 220px; padding: 29px 0 19px; }
  .intro h1 { font-size: clamp(36px, 8vw, 53px); }
  .intro-text { font-size: 15px; }
  .mascot-wrap { min-height: 150px; }
  .mascot-disc { width: 134px; height: 134px; }
  .mascot { width: 124px; height: 124px; border-width: 4px; }
  .mascot-caption { right: 0; bottom: 1px; font-size: 13px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .page-shell { width: min(100% - 24px, 430px); }
  .topbar { min-height: 66px; }
  .brand { gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand-name { font-size: 16px; }
  .button-discord { min-height: 42px; padding: 8px 10px; font-size: 12px; }
  .member-label { max-width: 90px; font-size: 12px; }
  .signed-in { gap: 8px; }
  .intro { grid-template-columns: minmax(0, 1fr) 96px; gap: 4px; min-height: 188px; padding: 24px 0 17px; }
  .intro h1 { font-size: clamp(31px, 9.5vw, 43px); }
  .intro-text { margin-top: 12px; font-size: 13px; line-height: 1.45; }
  .eyebrow { max-width: 220px; font-size: 10px; }
  .mascot-wrap { min-height: 118px; }
  .mascot-disc { width: 92px; height: 92px; }
  .mascot { width: 86px; height: 86px; border-width: 3px; }
  .mascot-caption { right: -3px; bottom: -2px; font-size: 10px; }
  .composer { padding: 19px 15px; border-radius: 14px; }
  .composer-heading { align-items: start; gap: 8px; margin-bottom: 17px; }
  .composer-heading h2 { font-size: 24px; }
  .member-required { max-width: 112px; padding-top: 3px; font-size: 11px; text-align: right; }
  .mode-switch { width: 100%; }
  .mode-tab { flex: 1 1 0; padding-inline: 8px; font-size: 13px; }
  .editor-toolbar { align-items: start; flex-direction: column; gap: 5px; padding: 10px 11px; }
  .extension-controls { width: 100%; }
  .select-wrap-format { flex: 1 1 auto; width: 100%; }
  #extension { min-width: 0; }
  #custom-extension { width: 115px; }
  #paste-content { min-height: 210px; padding: 14px 13px; font-size: 12px; }
  .editor-footer { align-items: start; gap: 8px; padding: 8px 10px; font-size: 11px; }
  .character-count { flex: 0 0 auto; }
  .drop-area { min-height: 166px; padding: 18px 12px; }
  .drop-title { font-size: 16px; }
  .drop-subtitle { font-size: 12px; }
  .settings-grid { gap: 11px; margin-top: 13px; }
  .setting-block { padding: 14px; }
  .expiry-controls { display: grid; grid-template-columns: 1fr; }
  .custom-expiry { display: grid; grid-template-columns: 90px minmax(0, 1fr); }
  #expiry, #custom-unit { width: 100%; }
  .submit-row { align-items: stretch; flex-direction: column; gap: 12px; }
  .submit-note { font-size: 12px; }
  #create-button { width: 100%; }
  .result-panel { padding: 19px 15px; }
  .result-panel h2 { font-size: 25px; }
  .share-field { flex-direction: column; }
  .share-field .button { width: 100%; }
  .paste-view { padding: 17px 13px; }
  .paste-view-heading { align-items: start; flex-direction: column; gap: 10px; }
  .expiry-stamp { text-align: left; }
  .content-toolbar { align-items: stretch; flex-direction: column; gap: 8px; padding: 11px; }
  .content-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #opened-content { min-height: 170px; padding: 14px; font-size: 12px; }
  .footer { flex-direction: column; gap: 5px; padding-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
