/* romisec-education（ROMISEC と同じ色づかい。スマホで使いやすいことを優先） */
:root {
  --bg: #fbfaf8;
  --ink: #16152a;
  --muted: #5d6178;
  --line: #ebe8f2;
  --card: #fff;
  --violet: #6d5efc;
  --pink: #ec4899;
  --orange: #f59e0b;
  --red: #d63a4a;
  --grad: linear-gradient(120deg, #6d5efc 0%, #ec4899 55%, #f59e0b 100%);
  --radius: 20px;
  --shadow: 0 1px 2px rgba(22, 21, 42, .04), 0 12px 32px rgba(22, 21, 42, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(700px 420px at 0% 0%, #ece9ff, transparent 60%), radial-gradient(600px 400px at 100% 10%, #ffe6dc, transparent 60%), var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.7;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--violet); }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.eyebrow { display: inline-block; margin: 0 0 8px; font-size: .78rem; font-weight: 700; color: var(--violet); letter-spacing: .08em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ヘッダー・フッター */
.site-header { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); background: rgba(251, 250, 248, .85); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 8px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: .02em; }
.logo-dash { color: var(--muted); }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; }
.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav a, .link-button { text-decoration: none; font-size: .9rem; font-weight: 600; color: var(--muted); padding: 8px 10px; border-radius: 999px; }
.nav a:hover, .link-button:hover { background: #fff; color: var(--ink); }
.nav a.btn { color: #fff; }
.link-button { background: none; border: 0; font-family: inherit; cursor: pointer; color: var(--violet); }
.inline { display: inline; margin: 0; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 28px; font-size: .85rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-inner nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-inner a { color: var(--muted); }
.footer-inner p { margin: 0; }
.impersonation-bar { background: #2b1d54; color: #fff; font-size: .85rem; padding: 6px 0; }

/* ボタン・カード・フォーム */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font: inherit; font-weight: 700;
  padding: 11px 20px; border-radius: 999px; border: 0; cursor: pointer; background: var(--ink); color: #fff; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, button:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(236, 72, 153, .2); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: var(--red); color: #fff; }
.btn-small { padding: 7px 14px; font-size: .86rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .88rem; }
.form input, .form select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #d9d5e6; border-radius: 12px; background: #fff; color: var(--ink); }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-actions form { margin: 0; }
.flash { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--line); background: #fff; }
.flash-success { border-color: #b6e8d3; background: #effaf5; }
.flash-error { border-color: #f3c0c6; background: #fff1f3; }
.flash-info { border-color: #d4cffc; background: #f4f2ff; }
.error-code { font-size: 3rem; font-weight: 800; margin: 0; }

/* 入口ページ */
.hero { padding: 24px 0 12px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); }
.lead { color: var(--muted); font-size: 1.02rem; max-width: 680px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.install-hint { font-size: .9rem; background: #fff; border: 1px dashed #d4cffc; border-radius: 14px; padding: 10px 14px; }
.tool-section { margin-top: 28px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.tool-card { display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; }
a.tool-card:hover { transform: translateY(-2px); }
.tool-card.is-soon { opacity: .62; box-shadow: none; }
.tool-icon { font-size: 1.7rem; line-height: 1; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: #f4f2ff; flex: none; }
.tool-body { display: grid; gap: 2px; }
.tool-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-desc { font-size: .86rem; color: var(--muted); }
.badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eceaf3; color: var(--muted); }
.badge-student { background: #f4f2ff; color: var(--violet); }
.about-student { margin-top: 32px; }
.about-student ul { padding-left: 1.2em; }

/* 自分専用のホーム画面 */
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.home-title { font-size: clamp(1.4rem, 4vw, 1.9rem); margin: 0; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; align-items: start; }
.groups .group { margin: 0; }
.groups.is-editing { grid-template-columns: minmax(0, 1fr); }
.group { min-width: 0; }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.group-head h2 { margin: 0 0 10px; }
.hint { font-size: .84rem; color: var(--muted); background: #f8f7fc; border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.link-tile { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; text-decoration: none; color: var(--ink); text-align: center; }
.link-tile:hover { background: #f6f5fb; }
.link-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.25rem; line-height: 1; background: var(--violet); }
.link-icon.small { width: 30px; height: 30px; border-radius: 9px; font-size: .9rem; flex: none; }
.link-title { font-size: .8rem; line-height: 1.35; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c0 { background: #6d5efc; } .c1 { background: #ec4899; } .c2 { background: #f59e0b; } .c3 { background: #10b981; }
.c4 { background: #0ea5e9; } .c5 { background: #8b5cf6; } .c6 { background: #ef4444; } .c7 { background: #14b8a6; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.edit-links { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.edit-links details { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; overflow: hidden; }
.edit-links details[open] { display: grid; gap: 10px; }
.edit-links summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; min-width: 0; }
.edit-links summary::-webkit-details-marker { display: none; }
.edit-link-title { font-weight: 600; flex: none; }
.edit-link-url { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.add-link, .group-settings { margin-top: 8px; }
.add-link summary, .group-settings summary, .ios-help summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--violet); }
.add-link[open], .group-settings[open] { display: grid; gap: 10px; }
.group-settings summary { color: var(--muted); }
.ios-help { margin-top: 20px; }

@media (max-width: 560px) {
  .card { padding: 16px; }
  .groups { grid-template-columns: minmax(0, 1fr); }
  .link-grid { grid-template-columns: repeat(4, 1fr); }
  .inline-form { grid-template-columns: 1fr; }
  .logo { font-size: .92rem; }
}
/* 変更後にその場所へ戻ったとき、見出しが上の固定ヘッダーに隠れないように */
.group, .edit-links li, #add-group { scroll-margin-top: 84px; }
