:root {
  --brand-900: #0d47a1;
  --brand-700: #1565c0;
  --brand-500: #0277bd;
  --accent: #4dd0e1;
  --bg-0: #020817;
  --bg-1: #0a1628;
  --bg-2: #0d1b3e;
  --text: #eaf2ff;
  --text-dim: rgba(234, 242, 255, 0.65);
  --text-faint: rgba(234, 242, 255, 0.4);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.12);
  --danger: #ff8a80;
}

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

/* display指定を持つ要素でもhidden属性を確実に効かせる
   (.line-gateのdisplay:flexがhiddenに勝ってしまう事故を防ぐ) */
[hidden] {
  display: none !important;
}

/* Material Symbolsは塗りのパスなのでcurrentColorで着色する */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  fill: currentColor;
}

/* シートとスライドはバーを出さない(スクロール操作は従来どおり可能) */
.dl-sheet,
.slides-doc {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dl-sheet::-webkit-scrollbar,
.slides-doc::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* 書類プレビューは続きがあると分かるよう細いバーだけ残す */
.office-doc,
.preview pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 140, 170, 0.5) transparent;
}

.office-doc::-webkit-scrollbar,
.preview pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.office-doc::-webkit-scrollbar-thumb,
.preview pre::-webkit-scrollbar-thumb {
  background: rgba(120, 140, 170, 0.5);
  border-radius: 999px;
}

.office-doc::-webkit-scrollbar-track,
.preview pre::-webkit-scrollbar-track {
  background: transparent;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: "Noto Sans JP", "Helvetica Neue", system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 40%, var(--bg-2) 100%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -10%, rgba(77, 208, 225, 0.14), transparent 70%),
    radial-gradient(500px 500px at -10% 100%, rgba(13, 71, 161, 0.35), transparent 70%);
  z-index: 0;
}

.site-header,
.wrap,
.site-footer {
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.site-header {
  padding: 1.25rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

/* 白一色のロゴなのでマスクにして好きな色を乗せる */
.logo-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background-color: var(--accent);
  -webkit-mask: url("logo.svg") no-repeat center / contain;
  mask: url("logo.svg") no-repeat center / contain;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.logo-ja {
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.logo-en {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
}

/* ===== Layout ===== */
.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  flex: 1;
}

.hero {
  text-align: center;
  margin: 1.5rem 0 2.5rem;
}

.hero-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.hero-title {
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.hero-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.8;
}

/* ===== Card ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.code-input {
  width: 100%;
  padding: 0.9rem 0.5rem;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--text);
  background: rgba(2, 8, 23, 0.5);
  border: 2px solid var(--card-border);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.code-input::placeholder {
  color: var(--text-faint);
  letter-spacing: 0.12em;
}

.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(77, 208, 225, 0.15);
}

.hint {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin: 0.6rem 0 1.25rem;
  line-height: 1.7;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), #00acc1);
  color: #fff;
  box-shadow: 0 6px 20px rgba(2, 119, 189, 0.35);
}

.btn-primary:not(:disabled):hover {
  box-shadow: 0 8px 26px rgba(2, 119, 189, 0.5);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  color: var(--text);
}

.btn-ghost:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.12);
}

/* loading spinner */
.spinner {
  display: none;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error {
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--danger);
  line-height: 1.7;
}

/* ===== Result ===== */
.result-card {
  animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.result-head {
  margin-bottom: 1.25rem;
}

.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 900;
  color: #052e16;
  background: linear-gradient(135deg, #86efac, #4ade80);
  border-radius: 999px;
}

/* ===== Preview ===== */
.preview {
  background: rgba(2, 8, 23, 0.5);
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview img,
.preview video {
  display: block;
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
}

.preview audio {
  width: 100%;
  padding: 1.5rem 1rem;
}

.preview iframe {
  width: 100%;
  height: 340px;
  border: 0;
  background: #fff;
}

.preview pre {
  width: 100%;
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dim);
}

.file-icon-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.75rem 1rem;
  color: var(--text-faint);
}

.file-ext-badge {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--card-border);
  border-radius: 0.4rem;
}

.preview-loading {
  padding: 1.75rem 1rem;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.preview-error {
  font-size: 0.65rem;
  color: var(--danger);
  text-align: center;
}

/* Office系プレビュー(白い紙面風) */
.office-doc {
  width: 100%;
  max-height: 380px;
  overflow: auto;
  padding: 1.1rem 1.2rem;
  background: #fff;
  color: #1a1a1a;
  font-size: 0.75rem;
  line-height: 1.9;
  text-align: left;
}

.office-doc h1,
.office-doc h2,
.office-doc h3 {
  font-size: 0.95rem;
  font-weight: 900;
  margin: 0.8rem 0 0.4rem;
  color: var(--brand-900);
}

.office-doc p {
  margin: 0 0 0.5rem;
}

.office-doc ul,
.office-doc ol {
  margin: 0 0 0.5rem 1.2rem;
}

.office-doc img {
  max-width: 100%;
  height: auto;
  margin: 0.4rem 0;
}

.office-doc table {
  border-collapse: collapse;
  margin: 0.4rem 0;
  font-size: 0.7rem;
}

.office-doc th,
.office-doc td {
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0.3rem 0.55rem;
  text-align: left;
  white-space: nowrap;
}

.office-doc th {
  background: #eef3fb;
  font-weight: 700;
}

/* Excel */
.sheet-block + .sheet-block {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.sheet-name {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  background: #217346;
  padding: 0.15rem 0.6rem;
  border-radius: 0.35rem;
  margin-bottom: 0.5rem;
}

.sheet-empty,
.sheet-more {
  font-size: 0.68rem;
  color: #777;
}

/* PowerPoint: スライドを横スクロールで送るだけのシンプルな作り */
.slides-doc {
  display: flex;
  width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.slide-card {
  flex: 0 0 100%;
  scroll-snap-align: center;
  background: #fff;
  color: #1a1a1a;
  padding: 1.1rem 1.2rem;
  min-height: 200px;
  text-align: left;
}

.slide-card + .slide-card {
  border-left: 1px solid rgba(0, 0, 0, 0.15);
}

.slide-num {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #c43e1c;
  margin-bottom: 0.5rem;
}

.slide-title {
  font-size: 0.85rem;
  font-weight: 900;
  margin: 0 0 0.35rem;
}

.slide-text {
  font-size: 0.72rem;
  margin: 0 0 0.25rem;
  color: #333;
}

.slide-empty {
  color: #999;
}

.slide-img {
  max-width: 100%;
  height: auto;
  margin-top: 0.5rem;
  border-radius: 0.3rem;
}

/* 画像/PDF書き出し用の画面外コンテナ */
.export-holder {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
}

.export-page {
  max-height: none;
  overflow: visible;
  padding: 48px 56px;
  font-size: 14px;
}

.export-page th,
.export-page td {
  white-space: normal;
}

/* ===== File meta / code ===== */
.file-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.file-name {
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--text-faint);
}

.code-display {
  text-align: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin: 1rem 0 1.25rem;
}

.link-btn {
  display: block;
  margin: 1.25rem auto 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== ダウンロード形式シート ===== */
.dl-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 90;
}

.dl-backdrop.open {
  opacity: 1;
}

.dl-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  transform: translate(-50%, 100%);
  background: #0f1c33;
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-radius: 1.5rem 1.5rem 0 0;
  padding: 0.75rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
  max-height: 85vh;
  overflow-y: auto;
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 95;
}

.dl-sheet.open {
  transform: translate(-50%, 0);
}

.dl-handle {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(234, 242, 255, 0.3);
  margin: 0 auto 1.1rem;
}

.dl-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.25rem;
}

.dl-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dl-option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.7rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.dl-option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--card-border);
}

.dl-option.busy {
  opacity: 0.5;
  pointer-events: none;
}

.dl-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 0.6rem;
  color: #fff;
  background: #37474f;
}

.dl-badge .icon {
  width: 28px;
  height: 28px;
}

.dl-badge[data-color="word"] { background: #2b579a; }
.dl-badge[data-color="image"] { background: #0f8f7f; }
.dl-badge[data-color="pdf"] { background: #b30b00; }
.dl-badge[data-color="excel"] { background: #217346; }
.dl-badge[data-color="ppt"] { background: #c43e1c; }
.dl-badge[data-color="zip"] { background: #4a5568; }

.dl-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.dl-option-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.dl-option-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.dl-close {
  margin-top: 1.1rem;
}

/* 確認ビュー */
.dl-confirm-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.9rem;
  color: var(--accent);
}

.dl-confirm-icon .icon {
  width: 44px;
  height: 44px;
}

.dl-confirm-text {
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 1.4rem;
}

.dl-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.result-share {
  margin-top: 0.6rem;
}

/* ボタン内の2行ラベル */
.btn-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.35;
}

.btn-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-faint);
}

/* ===== LINEアプリ内ブラウザの案内 ===== */
.line-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
}

.line-gate-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  padding: 2rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.line-gate-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  color: #ffca28;
}

.line-gate-icon .icon {
  width: 48px;
  height: 48px;
}

.line-gate-title {
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 0.9rem;
}

.line-gate-text {
  font-size: 0.82rem;
  line-height: 2;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.line-gate-text strong {
  color: var(--accent);
  font-size: 0.95rem;
}

.line-gate-note {
  font-size: 0.68rem;
  line-height: 1.8;
  color: var(--text-faint);
  margin-top: 1.1rem;
}

/* ===== Footer / Toast ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.7rem;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  background: rgba(234, 242, 255, 0.95);
  color: var(--bg-0);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: pop-in 0.25s ease;
}
