/* ---------- Unicode Art (saved output-area snapshots, as tiles) --------- */
/* Combined "マイリスト操作" button: hidden by default (desktop keeps the
   three separate buttons, which have room); shown only on mobile (see the
   max-width:768px media query), which hides those three instead. */
#art-mylist-menu-btn {
  display: none;
}

/* Matches .btn.small's padding (5px, not .mylist-select's usual 7px) so the
   view dropdown sits at the same height as the ＋作成/名前変更/削除/保存
   buttons sharing its row. */
#panel-art .mylist-select {
  padding: 5px 10px;
  font-size: .8rem;
  line-height: 1;
  /* native <select> chrome enforces its own minimum height regardless of
     padding/line-height on some platforms; appearance:none hands full box
     control back to us so it can actually match the buttons' height. */
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}

.art-board {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px clamp(10px, 3vw, 20px);
}

/* Vertical masonry via CSS multi-column layout: tiles flow down each column
   before wrapping to the next, so tiles of differing heights (short vs. long
   Art pieces) pack tightly instead of forced into uniform grid rows. */
.art-grid {
  column-width: 170px;
  column-gap: 10px;
}

/* Whole tile is the tap target (see bindArtBoard in app.js: tap inserts,
   long-press/right-click opens a menu with rename/share/mylist/delete --
   same interaction as every other board in the app, so no corner buttons
   are needed here). */
.art-tile {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 10px;
  /* 1 title line + 1 preview line + padding/border, not the old flat 90px
     (which left tall empty space under short/single-character pieces). */
  min-height: 59px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  overflow: hidden;
  cursor: pointer;
  /* long-press here opens the menu (see bindArtBoard in app.js); without
     this, mobile browsers show their native text-selection magnifier/
     handles over the tile's text first instead -- same fix as .cell. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.art-tile:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.art-tile-title {
  margin-bottom: 4px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ~70% of the old 1.1rem. white-space:pre (not word-break:break-all) so a
   long line never wraps -- for an Art piece, wrapping would shift later
   characters onto a new line and visibly wreck the picture's alignment.
   Overflow is clipped as a last-resort safety net; app.js additionally
   shrinks the font-size per-tile (see renderArtBoard) so most content fits
   without ever needing to clip. Height is capped at 20 lines' worth (see
   the truncation in renderArtBoard) rather than clamped by CSS. */
.art-tile-text {
  font-family: var(--font-glyph);
  font-size: .77rem;
  line-height: 1.4;
  white-space: pre;
  overflow: hidden;
}

/* ---------- パターン工房 (pattern studio inside the Unicode Art tab) ----- */
/* 作品/パターン工房 sub-view pills, sitting between the main mode tabs and
   whichever sub-view's board-bar is showing. */
.art-subtabs {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 8px clamp(10px, 3vw, 20px) 0;
}

.art-subtab {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: .8rem;
}

.art-subtab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
  box-shadow: none;
}

/* Each sub-view owns its board-bar + scrolling board, mirroring what .panel
   provides for the whole tab. */
.art-subview {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.art-subview[hidden] {
  display: none;
}

.pattern-board {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px clamp(10px, 3vw, 20px);
}

.pattern-section-title {
  margin: 14px 0 8px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

.pattern-section-title:first-child {
  margin-top: 0;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

/* Whole tile is the tap target (tap = expand/apply, long-press/right-click =
   menu), same interaction as .art-tile -- see bindTileBoard in app.js. */
.pattern-tile {
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  overflow: hidden;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pattern-tile:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.pattern-tile-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pattern-tile-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fav) 22%, transparent);
  color: var(--fav);
  font-size: .65rem;
  font-weight: 600;
}

/* white-space:pre for the same reason as .art-tile-text: wrapping would
   shift characters and wreck the sample's alignment; clip instead. */
.pattern-tile-preview {
  display: block;
  font-family: var(--font-glyph);
  font-size: .8rem;
  line-height: 1.4;
  white-space: pre;
  overflow: hidden;
  max-height: calc(1.4em * 4);
}

